From: dh on
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
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