c# - 如何编写实验框架

标签 c# asp.net

我是一名中级 C#/ASP.net 编码员,正在从事一个有趣的 MVC 项目。我想实现一个实验框架,允许对象“微动”功能,以便找到更好的做事方式。我在哪里可以阅读有关此类内容的最佳实践或教程的更多信息?

例如

// A helper class that might return different flavors of "mean".
public class MeanHelper
{
  ...
  Mean(IEnumerable<double> input) { <shuffle between the 3 below.> }

  OrdinaryMean(IEnumerable<double> input) { ... }
  GeometricMean(IEnumerable<double> input) { ... }
  HarmonicMean(IEnumerable<double> input) { ... }
  ...
}

非常感谢!

最佳答案

你描述的听起来像 strategy pattern ;例如,您可以有一个接口(interface) IMean、一个方法 Calculate 和 3 个实现。

关于c# - 如何编写实验框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6700176/

相关文章:

c# - DbContext 已被释放

asp.net - 使用 asp.net 用户控件时我应该把 JavaScript 放在哪里?

c# - 确定类型是否为枚举类型的通用列表

c# - 当 SelectedIndex 属性更改时,ListBox 的 SelectedItem 属性会更改吗?

c# - Entity Framework - 存储库检查(大文本)

asp.net - 为什么更新面板会对自定义控件进行完整回发?

c# - 工厂类知道的太多了

c# - C# : create an instance initialized with values of a superclass instance 中的继承

iis - 网页无法访问文件夹。 (IIS)

asp.net - 如何在使用Docx dll生成word文档时在标题中添加图像和文本?