none
Sorting of Date other than Alphabitacally ?

    Question

  • Hi

    i want to sort data in my table other then Asending or Desending.

    i want to sort like Principal then Professor then Lecturer and then Assistant..

    What should i do..

    i tried many way like advance filter option but it wont work properly..

    thanks

    Regards

    Mahmood

    Thursday, January 26, 2017 8:30 PM

All replies


  • Hi  Mah786,

    >>i want to sort like Principal then Professor then Lecturer and then Assistant.

    You can try to Specifies the object for the IComparer class.

     class PeoplepositionComparer : IComparer<People>
        {
            public int Compare(People first, People second)
            {
                return first.ID.CompareTo(second.ID);
            }
        }
    
        public class People
        {
            public int ID { get; set; }//Corresponding to the ID of each position, to facilitate the sort
            public string position { get; set; }
    
        }
    
        PeopleListSample.Sort(new PeoplepositionComparer());
    

    Best Regards,

    Yohann Lu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 27, 2017 3:37 AM