Why does WCF return myObject[] instead of List like I was expecting?

前端 未结 4 584
甜味超标
甜味超标 2020-11-27 03:10

I am returning a List from my WCF method. In my client code, it\'s return type shows as MyObject[]. I have to either use MyObject[], or IList, or IEnumerable...



        
4条回答
  •  野性不改
    2020-11-27 03:39

    When you use svcutil.exe to create you client code you need to tell it how to resolve certain references that are not available to it.

    This is how you would do it for List:

    svcutil /o:YourService.cs /ct:System.Collections.Generic.List`1 http://example.com/mex
    

提交回复
热议问题