Please refer below code

public class NNAEmployeeDetails
    {
        public string DealerCode { get; set; }
        public string EmployeeCode { get; set; }
        public string EmployeeName { get; set; }
}

IEnumerable<NNAEmployeeDetails> empList =GetList();

i am trying the sort the above ienumerable by Employeename by below code

empList.OrderBy(s=>s.EmployeeName)

but OrderBy itself not showing in empList. Please refer below image

enter image description here

why the OrderBy is not coming in empList ? is any namespace problem ? what is the exact behavior ? how to sort ienumerable by EmployeeName ?

有帮助吗?

解决方案

You need to have a using for System.Linq to access the LINQ extension methods.

Also note that OrderBy doesn't mutate the sequence, it creates a new sequence that is ordered.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top