I have a simple custom list class and I am trying to implement IComparable
to it, but it's not working to be honest. I tried MSDN and other blogs and still same.
public class sortDateTime : IComparable
{
protected DateTime m_startDate, m_endDate;
public DateTime startDate
{
get { return m_startDate; }
set { m_startDate = startDate; }
}
public DateTime endDate
{
get { return m_endDate; }
set { m_endDate = endDate; }
}
public int CompareTo(object obj)
{
if(obj is sortDateTime)
sortDateTime sDT = (sortDateTime) obj; //here ERROR
return m_stDate.CompareTo(sDT.m_stDate);
}
}
Followed this example, but getting the error:
Embedded statement cannot be a declaration or labeled statement