using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OfTypeDemo
{
class Program
{
static void Main(string[] args)
{
var numbers = new object[] { 1, "two", null, "3", 4 };
foreach (var anInt in numbers.OfType<int>())
Console.WriteLine(anInt);
Console.ReadLine();
}
}
}
LinQ转换运算符OfType<T>,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/swtool/p/3840037.html