views:

89

answers:

2

I'm am trying to test wcf method in C#. method return type is ilist. I need to catch that returned data in to an ilist and then i have to retrive each item from ilist. can some one send me a sample code how to do this?

+2  A: 

Here is some template code. I don't know what the generic type that is being returned, so I put place holders for it.

IList<type of result> list = data.ReturnIList();
foreach(var item in list)
{
   //do stuff with the item
}
Oded
+5  A: 

It's perfectly fine to just iterate over an IList if that is what you're asking.

foreach(var item in MethodThatReturnsIList())
{
   // Do whatever
}
Oskar