Here is my code I am new to programming: I am trying since morning but couldn't figure out the solution, please correct my code and help me with it. Thank you.
other.ClientData.NumDay <== getting null here.
I am getting this error:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
assignment3.Booker.ClientData.get
returns null.
public int CompareTo(Booker other)
{
if (this.ClientData.NumDay > other.ClientData.NumDay)
{
return 1;
}
else if (this.ClientData.NumDay < other.ClientData.NumDay)
{
return -1;
}
else
{
return 0;
}
}
List<Booker> appointment = new List<Booker>(8)
foreach (var val in appointment)
{
Console.WriteLine(val);
}
appointment.Sort();
foreach (var val in appointment)
{
Console.WriteLine(val);
}