C# Using LINQ to Query and Filter Data from a Soap Service

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Im stuck here. I have an external Soap Service that Ive added as a service reference to my asp.net app. The service returns an array of objects, where each object contains a Category, Code and Description. Heres a sample of my code where Im returning
everything from the service:


<div style="color:Black;background-color:White; <pre>
problemReporting.soapClient s = <span style="color:Blue; new soapClient();
problemReporting.NullRequest nr = <span style="color:Blue; new NullRequest();
problemReporting.ProblemDescription[] GetDescriptList = s.getProblemDescriptionList(nr);

<span style="color:Blue; foreach (problemReporting.ProblemDescription item <span style="color:Blue; in GetDescriptList)
{
     lblDescCode.Text += item.code + <span style="color:#A31515; "<br />";
     lblDescCat.Text += item.category + <span style="color:#A31515; "<br />";
     lblDescript.Text += item.description + <span style="color:#A31515; "<br />";
}
[/code]

What want to do is filter the data from the service and return only the categories. Currently, there are only 4 categories, but that could change. The only examples I can find are using hard coded values. I need to extract and use the category names provided
by the service.
Im sort of new to C# and LINQ. It seems using a LINQ query is the best solution for filter the data from the service so it returns only the categories.
Any assistance is greatly appreciate. (Please advise if I didnt post this in the right category.)

View the full article
 
Back
Top