OfType<string>()

object[] vals = { 1, "Hello", true, "World", 9.1 };
IEnumerable<double> justStrings = vals.OfType<double>( );
foreach(var str in justStrings)
{
Console.WriteLine(str);
}

string[] names = { "Allen", "Arthur", "Bennett" };
string[] ayes = names.Where(s => s[0] == 'A').ToArray();

原文地址:https://www.cnblogs.com/Fred1987/p/5932458.html