在C#中使用var关键字
foreach(var item in someList) { // ... } // Type of 'item' not clear.var something = someObject.SomeProperty; // Type of 'something' not clear.var something = someMethod(); // Type of 'something' not clear.
var l = new List<string>(); // Obvious what l will be.var s = new SomeClass(); // Obvious what s will be.
var results = from r in dataContext.SomeTable select r; // Not *entirely clear* what results will be here.
var results = from item in someList where item != 3 select item;
var
是吗?
繁花如伊
湖上湖
慕容森
红颜莎娜