通用的扩展方法来显示控制台中的任何类型的列表:
public static void ShowList<T>(this IEnumerable<T> Values)
{
foreach (T item in Values)
{
Console.WriteLine(item);
}
}
当我有一个string
可以用这个方法
string text = "test";
text.ShowList();
怎么能排除string
从这个方法?
ShowList<T>(this IEnumerable<T> Values): Where != string //doesn't work
相似问题