我存储了一堆继承自抽象类的各种类的对象Creative
。我想看看存储了什么,所以我写了一个这样的方法:
public void GetCreativeTypes()
{
var types = from Creative c in original.AsQueryable<Creative>()
select string.Format("{0}: {1}", c.CreativeType, c.GetType());
foreach (var type in types.Distinct())
{
Debug.WriteLine(type);
}
return;
}
...但这不会返回任何结果。我也试过:
public void GetCreativeTypes()
{
var types = from Creative c in original
select string.Format("{0}: {1}", c.CreativeType, c.GetType());
foreach (var type in types.Distinct())
{
Debug.WriteLine(type);
}
return;
}
结果相同。我怎样才能得到我想要的结果?
原始集合中的对象就像
public class ImageCreative : Creative{}
public class FlashCreative : Creative{}
...ETC。