Anonymous type (anonymouse type)--What multiple systems are anonymous these days:
a mechanism for automatically generating types based on initialization lists at initialization time.
Typical code:
1class Program
2 {
3 static void Main (string[] args)
4 {
5 var x = new {a = 3, B = 5, c = "some text"};
6 Console.WriteLine (x.a.ToString ());
7 }
8 } very strange ~ ~ ~
Do not think that this var x is really no type, in fact, this is a compiler magic,
when we compile this code, the compiler will automatically produce the following types of definitions:
1class __anonymous1
2{
3 private int _a = 3;
4 private int _b = 5;
5 private String _c = "some text";
6
7 public int a {get {return _a;} set {_a = value;}}
8 public int B {get {_b;} set {_b = value;}}
9 public int C {get {_c;}set {_c = value;}}
10}
One
This does not have to be initialized with my previous Var, and must let the compiler "guess" the correct type of this sentence is contradictory.
PS: In another 20 years, the compiler will be able to do anything, or industry experts, "boss, buy a compiler for the telecommunications industry, with SP value-added services expansion Package"