抽象クラスから継承したさまざまなクラスのオブジェクトの束を格納しました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{}
...等。