LINQ in Action roller

LINQ and recursive functions

Hello all, I'm blocked with a LINQ query I have the following class : public class MyClass { public MyClass(int val) { this.Val = val; } public int Val; public List<MyClass> MyList = new List<MyClass>(); } static void Main(string[] args) { MyClass c1 = new MyClass(10); MyClass c2 = new MyClass(20); c1.MyList.Add(c2); c2.MyList.Add(c1); } I want to be able to extract the sum of the "Val" property of c1 : ie c1.Val + the value of all classes in MyList. In this case, it's simple, Read More...
Published Monday, June 4, 2007 8:56 AM by MSDN Forums: LINQ Project General
Anonymous comments are disabled

Featured Item

This Blog

Sponsoring

Syndication