标签:from type gre ring 元素 学习 arraylist blog student
OfType操作根据集合中的元素是否是给定的类型进行筛选
IList mixedList = new ArrayList(); mixedList.Add(0); mixedList.Add("One"); mixedList.Add("Two"); mixedList.Add(3); mixedList.Add(new Student() { StudentID = 1, StudentName = "Bill" }); var stringResult = from s in mixedList.OfType<string>() select s; var intResult = from s in mixedList.OfType<int>() select s;
var stringResult = mixedList.OfType<string>();
标签:from type gre ring 元素 学习 arraylist blog student
原文地址:http://www.cnblogs.com/lanpingwang/p/6602145.html