我試圖讓所有不從一個指定的類繼承的子列表,也得到父/根列表類型。我無法弄清楚語法。這是我正在尋找的那種事情的一個例子。謝謝你提供的所有幫助!LINQ列表子列表
public class Foo
{
public IList<Type> Bar { get; private set; }
}
List<Foo> test = new List<Foo>();
// Initialize, add values, etc.
var result = from f in test
from b in f.Bar
where !b.IsSubclassOf(typeof(AnotherClass))
select f.GetType(), b
對我來說,問題並不清楚:你能否更清楚地給出一個示例輸入和相關輸出(甚至只是草圖)? – 2010-04-01 19:17:16