I have a IEquatable<T>
method thus:
public bool Equals(TravelOptions other)
{
if (other == null) return false;
return
this.OutTravelType.Equals(other.OutTravelType) & //enum
this.BackTravelType.Equals(other.BackTravelType) & //enum
this.OutTravelPointID.Equals(other.OutTravelPointID) & //int
this.BackTravelPointID.Equals(other.BackTravelPointID) & //int
this.OutTerminal.Equals(other.OutTerminal) & //string
this.BackTerminal.Equals(other.BackTerminal) & //string
this.OutTime.Equals(other.OutTime) & //string :(
this.BackTime.Equals(other.BackTime) & //string
this.Checkin.Equals(other.Checkin) & //int
this.OutFree.Equals(other.OutFree) & //bool
this.BackFree.Equals(other.BackFree); //bool
}
but what I need to do is add some checks for nulls for various bits in there, as currently it will throw a nullreferenceexception is there some cunning way of doing that so it doesn't end up being a nasty mess? the out and back travel types are enums and are always set so checking those first. the out and back free are bools, and the travelpoints are ints, all the rest are strings. just feel it will get awfully messy if i start having to check for nulls, unless there is some shorthand way of doing that?
thanks