문제

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