From: dh on 17 Sep 2009 20:47 If there is a class member as: void Function(IEnumerable<ClassName> Param); What is expected to be passed into this function? A "List"? Is it OK to code like below? List<ClassName> myList = new List<ClassName>(); ClassName obj1 = new ClassName(); ClassName obj2 = new ClassName(); .... myList.Add(obj1); myList.Add(obj2); Function(myList);
From: Peter Duniho on 17 Sep 2009 21:12 On Thu, 17 Sep 2009 17:47:01 -0700, dh <dh(a)discussions.microsoft.com> wrote: > If there is a class member as: > > void Function(IEnumerable<ClassName> Param); > > What is expected to be passed into this function? A "List"? Any object that implements IEnumerable<ClassName> (List<ClassName> does happen to qualify, but it doesn't have to be a List<ClassName> object). > Is it OK to code like below? > > List<ClassName> myList = new List<ClassName>(); > > [...] > Function(myList); It compiles, doesn't it? Is there some particular problem you're worried about? Is something not working the way you expect it to? Pete
|
Pages: 1 Prev: JSON Circular Reference Next: C# simple permutation of a binary array |