2012年12月24日 星期一

.Net 的基本技巧


建構子constructor 的相互呼叫 
建構子後面會加上 :this 的方式來呼叫另一個建構子,如下一個沒有參數的建構子會帶一個參數給另一個有帶參數的建構子
public Constructor1(): this(string1)
  {
  }
 
  public Constructor1(String string1)
  {
      ....          
  }




Constraints on Type Parameters

在新增 generic class 時可以限制其類別為何, 如下

public class Repository1 where TEntity : class


http://msdn.microsoft.com/en-us/library/d5x73970.aspx




Dynamic Entity Framework Queries with Predicate Builder


http://www.jaltiere.com/index.php/2012/02/15/dynamic-entity-framework-queries-with-predicate-builder/




Dynamically Composing Expression Predicates - Using PredicateBuilder

http://www.albahari.com/nutshell/predicatebuilder.aspx

沒有留言:

張貼留言