0
是否可以創建IEnumerable
變量,將另一個列表的foreach元素指向特定的屬性?列表對象屬性的枚舉器
//...
SomeList<classA> MainList = new SomeList<classA>();
IEnumerable<string> InnerList = ??MainList??;
MainList.add(new classA());
Console.Writeline(InnerList.First());
// ->"Hello World"
//...
class classA{
public string innerObject = "Hello World";
}
相關文檔:http://stackoverflow.com/documentation/c%23/68/linq-queries/303/select-transforming-elements –