I have tried the solutions I have found and cannot seem to make this work for me.
I have a 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 a call to a service:
InvokeGetReportRequestListResponse callResponse = InvokeGetReportRequestList(callRequest);
And now I want to sort the Reports list in callResponse by CompletedDate
callResponse.Reports.Sort((x, y) => DateTime.Compare(x.CompletedDate, y.CompletedDate));
This returns an error:
Cannot convert lambda expression to type 'System.Collections.Generic.IComparer<WebFeeds.Amazon.API.DataTypes.RequestedReport>' because it is not a delegate type
                Sorting can be done using Linq via the following statement.
var Result = callResponse.Report.OrderBy( iItem => iItem.CompletedDate );
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With