我有一个返回列表的通用方法“GetSomeData”。我可以是 int、double、uint 的列表...
public void GenericMethod<T>()
{
List<T> genericList = GetSomeData<T>();
List<double> castedList1 = (List<double>) genericList;
List<double> castedList2 = genericList.Cast<double>(); //Not working
List<double> castedList3 = genericList.Select(f => (double)f).ToList(); //not working
}
T 可以是 int、uint、double...
有没有办法投射这个名单?