标签:style blog color ar 使用 for sp div on
public static void Print(IEnumerable myList) { int i = 0; foreach (Object obj in myList) { if (obj is Student)//这个是类型的判断,这里Student是一个类或结构 { Student s=(Student)obj; Console.WriteLine("\t[{0}]:\t{1}", i++, s.Sname); } if (obj is int) { Console.WriteLine("INT:{0}",obj); } } Console.WriteLine(); }
List<string> fruits = new List<string> { "apple", "orange", "banana" }; //去遍历 IEnumerable<string> query = fruits.Where(fruit => fruit.Length == 6); foreach (var q in query) { Console.WriteLine(q); } Console.ReadLine();
标签:style blog color ar 使用 for sp div on
原文地址:http://www.cnblogs.com/zhayunjia/p/4073911.html