【发布时间】:2016-04-28 20:38:37
【问题描述】:
有人可以帮忙解决以下问题吗...这让我发疯了...
// Three methods, virtually identical with the exception of the select field
public IEnumerable<int> GetBrandID()
{
return myData.Select(m => m.BrandID).Distinct();
}
public IEnumerable<int> GetModelID()
{
return myData.Select(m => m.ModelID).Distinct();
}
public IEnumerable<int> GetVehicleID()
{
return myData.Select(m => m.VehicleID).Distinct();
}
// How to create one method which returns the type specified in the parameter??
public IEnumerable<int> GetData(??? myType)
{
return myData.Select(m => myType).Distinct();
}
【问题讨论】:
-
一个海盗问另一个,“为什么那个轮子会从你的裤子里伸出来?”...