我试图让所有不从一个指定的类继承的子列表,也得到父/根列表类型。我无法弄清楚语法。这是我正在寻找的那种事情的一个例子。谢谢你提供的所有帮助!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