我想做这样的事情
public class ProductBiz: BizBase<Product> {
public List<String> BrokenRules {get;set;}
// Some kind of data + biz operation implementation
}
public static class ProductBizExtensions{
public ProductBiz Rule1(this ProductBiz prodBiz)
{}
public ProductBiz Rule2(this ProductBiz prodBiz)
{}
public bool ApplyRules (this ProductBiz prodBiz, Func<ProductBiz,bool> ruleset){}
}
然后在客户端代码中将其用作
productBiz.Rule1().Rule2();
productBiz.Rule2().Rule1();
或者
// create multicasted delegate of type Func<ProductBiz,bool> say rulesetDelegate
productBiz.ApplyRules(rulesetDelegate);
只是想在我深入潜水并淹死之前问一下。
这种方法有什么潜在的陷阱???
提前致谢