Lambda expression help needed

I have a webservice, which return the response in below format.


I have already consumed my webservice and want to read response. I have prepared model as StudentDetails with properties Name and Marks.

class StudentDetails
    public string Name{get;set;}
    public decimal Marks{get;set;}

So I want to read name and marks from above response (using some lambda expression or some easy way)

Need help in getting result from response something as below…

response.student(x => x. ////something to be here)

Please suggest.

I don’t understand that line of code. What is the type of response? Does it really have a student method that takes a lambda?

Yes response is we service response and it has student in it. Need to fetch that value (name and marks)

I agree with @svick in that it is hard to understand what you are looking for - since we don’t know what parameters the response.student method is expecting. However, with Linq to XML you should be able to get to the descendants that you want. You will want to:

  1. load the StudentList into a XElement
  2. Find it studentList.Descendants(“Details”)
  3. Do something with the descendents - based upon whatever the expected parameters are…

See dotnet/csharplang/ blob/58816d166e19f8513f3759c067d3f4080f416863/proposals/

There will also soon also be static lambdas I believe.

.NET Foundation Website | Blog | Projects | Code of Conduct