I have a LINQ query that I want to order by ascending on name.

 

See:

List<Employee> objemployee = new List<Employee>(){
            new Employee() {  Name = "Suresh",Skills  = "C"},
            new Employee() {  Name = "Rohini", Skills=  "SQL Server" },
              new Employee() {  Name = "Amit", Skills=  "SQL" },
            new Employee() {  Name = "Pankaj", Skills=  "ASP.NET" },
            new Employee() {  Name = "Suresh", Skills=  "MVC" }};
 
            var result =objemployee.OrderBy();

Please Help me.

1 Answers

  1. Aditya Kumar Patel
    LINQ Orderby ascending Query
    9/20/2018 5:29:59 PM

     Try to use it:

    List<Employee> objemployee = new List<Employee>(){
                new Employee() {  Name = "Suresh", Skills ="C"},
                new Employee() {  Name = "Rohini", Skills="SQL Server" },
                  new Employee() {  Name = "Amit", Skills="SQL" },
                new Employee() {  Name = "Pankaj", Skills="ASP.NET" },
                new Employee() {  Name = "Suresh", Skills="MVC" }};
     
                var result =objemployee.OrderBy(x => x.Name);

    I hope it will help to you.


Leave a answer

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

you may also like