Hey everyone. First time poster, long-time lurker. I may have found a question unanswered by search. Or I just don't know how to ask it.
Any easy way to pass a collection of class members? Other than making a new list?
So:
There's got to be something easier, right?Code:class Foo { public int x; } void MyFunc(List<int> list) { doSomething(list); } Main { List<Foo> listFoo = new List<Foo>(); List<int> listInt = new List<int>(); foreach (Foo foo in listFoo) listInt.Add(foo.x); MyFunc(listInt); }




Reply With Quote