c# - Sorting List by DateTime -


i have tried solutions have found , cannot seem make work me.

i have class:

public class invokegetreportrequestlistresponse {     public marketplacewebserviceexception error { get; set; }     public bool callstatus { get; set; }     public list<requestedreport> reports { get; set; } }  public class requestedreport {     public string reportrequestid;     public string reporttype;     public datetime? startdate;     public datetime? enddate;     public boolean scheduled;     public datetime? submitteddate;     public string reportprocessingstatus;     public string generatedreportid;     public datetime? startedprocessingdate;     public datetime? completeddate; } 

i make call service:

invokegetreportrequestlistresponse callresponse = invokegetreportrequestlist(callrequest); 

and want sort reports list in callresponse completeddate

callresponse.reports.sort((x, y) => datetime.compare(x.completeddate, y.completeddate));

this returns error:

cannot convert lambda expression type 'system.collections.generic.icomparer<webfeeds.amazon.api.datatypes.requestedreport>' because not delegate type 

sorting can done using linq via following statement.

var result = callresponse.report.orderby( iitem => iitem.completeddate ); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -