1. Anonymous Type
Anonymous Type allows us to define an object and initialize a group of arbitrary attribute lists. The Type of this object is not pre-defined. For example:
Var v = new {ID = Guid. NewGuid (), Name = "Zhang San "};
2. Extension Method
With E xtension Method, we can extend the Method member without changing the definition of Type: we define a Static Method with one feature in another Type, make it the E xtension Method of this Type. This Method can be called like other methods. The Operator of LINQ, such as Where, From, and Order by, are defined in this way.
3. Lambda Expression
Lambda expressions are widely used in LINQ. In essence, Lambda expressions are Delegate. In this section, I will introduce how Lambda expressions are implemented through a Delegate.
4. Automatically Impemented Property
With the Automatically Implemented Property, we can simplify the attribute definition of the traditional private field + public property, just like this:
Public class Vector {
Public double X {get; set ;}
Public double Y {get; set ;}
}
5. Object Initializer & Collection Initializer
Object Initializer & Collection Initializer combines Object creation and initialization into one: creates an Object and initializes its attribute members through an Object Initializer call at a time, use Collection Initializer to initialize the initial members of the Collection object when creating the Collection object:
Vector v = new Vector {X = 1, Y = 2 };
IList <string> list = new List <string> {"Zhang San", "Li Si", "Wang Wu "};