Simple Date Sort Class

This very simple class allows sorting of date when the object is added to a collection, such as an Array List.

using System;
using
System.Collections;
using
System.Text;

namespace
Adatis.Class
{
  class DateUpdatedSort : IComparable
{

  private string _name;
  private DateTime _date;

#region
Constructors

   public DateUpdatedSort()
{ }

   public DateUpdatedSort(string Name, DateTime DateUpdated)
{
      this._name = Name;
      this._date = DateUpdated;
}

#endregion


#region
Interface Methods

///


/// The Method that must re refenced in order for this object to be sorted.
///


///
///

public int CompareTo(object obj)

{
    if(obj is DateUpdatedSort)
{

DateUpdatedSort dus = (DateUpdatedSort)obj;
    return dus.UpdatedDate.CompareTo(this.UpdatedDate);

}
else
{
    throw new Exception(“Object Not Correct type)”;
}
}

#endregion

#region Public Properties

///


/// The name of Control
///


public string Name
{

get {return _name;}
set {_name = value;}
}

///


/// The Date Updated
///


public DateTime UpdatedDate
{
  get { return _date; }
  set { _date = value;}
}

#endregion

}
}