I have a web-service method that returns a
List<KeyValuePair<string,double>>
However when I use use that method in a service reference, the object it returns is
List<KeyValuePairOfStringDouble>
I cannot figure out how to use this.
I have a web-service method that returns a
List<KeyValuePair<string,double>>
However when I use use that method in a service reference, the object it returns is
List<KeyValuePairOfStringDouble>
I cannot figure out how to use this.
Your service reference is trying to make the best out of the WSDL it gets. But your service and your application have been playing games with each other. They were never allowed to directly talk. So you are now stuck with something that looks like what you need and is called like what you need, but it is not exactly what you need.
Simple solution is to build a new list that is what you syntactically need:
List<KeyValuePair<string,double>> yourlist = serviceResult.Select(kvp => new KeyValuePair<string, double>(kvp.Item1, kvp.Item2)).ToList();
For a better solution in the future you should let both ends of your service communication know what the other end is up to syntactically. This is called a contract assembly.
This thread on StackOverflow and the links that it contains might be a good start if you want to build one for your service.