For the anonymous type, I am a little lazy and can reprint it directly.Article: Http://blog.csdn.net/zlghitler/article/details/1706093
Anonymous type
C #2.0 introduced the anonymous method, and C #3.0 introduced the anonymous type. The anonymous type is similar to the anonymous method. They are both built in the embedded mode and do not have a formal name. To create an anonymous type, you must combine the above two concepts: Object initializer and hidden local variables. The following is an example of an anonymous type:
Varmytype = New {Length = 79 , Width = 30 }; // The range of the anonymous type is the same as that of any other variables. // For example, the followingCodeThe Cobra instance in the block is only valid in the Speed Function Block: Private Void Speed (){ VaR Cobra = New {Horsepower = 550 , Torque = 570 };} // If an anonymous type is initialized and another anonymous type is in the range domain, and their signatures are the same, the second type occupies the first type. // For example, in the following code, Cobra and Mustang are both anonymous and can be set to each other. Private Void Speed (){ VaR Cobra =New {Horsepower = 550 , Torque = 570 }; VaR Mustang = New {Horsepower = 300 , Torque = 300 }; Mustang = Cobra; // Or you cocould say Cobra = mustang }