0

The WCF web service I'm calling only returns an array of a specific object and IComparer apparently has not been implemented. This makes sorting a little more difficult than I think it should be so I'm wondering if there's a way I can fix that. Is it possible for me to implement IComparer, in my MVC project, on the WCF?

NealR
  • 10,189
  • 61
  • 159
  • 299
  • have you checked out this article [Sharing WCF Collection Types Between Services and Clients](http://www.codeproject.com/Articles/20342/Sharing-WCF-Collection-Types-Between-Services-and) – MethodMan Nov 27 '15 at 23:25
  • I'm pretty sure you can. In service references that I have used the classes were setup to be partial classes. If yours is the same way then you can create a separate file (one that would not be overwritten when you do a service refresh) and put your extensions for the partial files you want to improve in there. – Lorek Nov 27 '15 at 23:37
  • Normally, you should be sorting using `OrderBy` and `Comparer` is not needed. Post some code. – usr Nov 27 '15 at 23:44
  • 1
    Using C# LINQ to order the array , if you have a complex sorting order other than ascending or descending then you would want to implement your custom sorting with IComparer – Julius Depulla Nov 28 '15 at 00:20

0 Answers0