[英]can some one help me how to use IList in c#
I'm am trying to test wcf method in C#. 我正在尝试在C#中测试wcf方法。 method return type is ilist.
方法返回类型为ilist。 I need to catch that returned data in to an ilist and then i have to retrive each item from ilist.
我需要将返回的数据捕获到一个ilist中,然后我必须从ilist中检索每个项目。 can 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. 如果您要访问的是IList,那很好。
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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.