开发者

can some one help me how to use IList in c#

开发者 https://www.devze.com 2022-12-27 04:45 出处:网络
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. c开发者_StackOverflow社区an som

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. c开发者_StackOverflow社区an some one send me a sample code how to do this?


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

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


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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号