Click here to Skip to main content
15,886,258 members
Articles / Programming Languages / MSIL

Dynamic List Sorting

Rate me:
Please Sign up or sign in to vote.
4.78/5 (54 votes)
14 Feb 2006CPOL6 min read 313.5K   1.8K   84  
Dynamically sorting a list by using dynamic methods and delegates.
using System.Drawing;

namespace DynamicComparerSample
{
    public class Person
    {
        private string firstName;
        public string FirstName
        {
            get { return firstName; }
            set { firstName = value; }
        }

        private string lastName;
        public string LastName
        {
            get { return lastName; }
            set { lastName = value; }
        }

        private double age;
        public double Age
        {
            get { return age; }
            set { age = value; }
        }

        public Person(string firstName, string lastName, double age)
        {
            this.firstName = firstName;
            this.lastName = lastName;
            this.age = age;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer Jubii A/S
Denmark Denmark
Johannes Hansen was born in denmark during a thunderstorm in mid-june 1980.

He grew up stealing time on his father's C64 and finally got his own computer in 1995.

He currently work as a developer/ at the danish company Jubii A/S where he spends his time developing spam filters, portals and oher user-driven solutions using C#.

Comments and Discussions