T
tshad
Using VS 2005, I have list that I want to sort that has a nullable field.
I am getting an error:
'System.Nullable<int>' does not contain a definition for 'CompareTo'
I am getting an error on the "secondInstance test for ProjectTableID, which
is a nullable int (int?).
public class RacerComparer : IComparer<FieldName>
{
public int Compare(FieldName firstInstance, FieldName
secondInstance)
{
int result = 0;
result =
firstInstance.ProcessOrder.CompareTo(secondInstance.ProcessOrder);
if (result != 0) return (result); // if not equal, not need to
check Name
result =
secondInstance.ProjectTableID.CompareTo(secondInstance.ProjectTableID);
if (result != 0) return (result);
return result;
}
}
I can't even test for the null (HasValue), because I am getting the error on
the build.
How can I change this so that I don't get this error?
Thanks,
Tom
I am getting an error:
'System.Nullable<int>' does not contain a definition for 'CompareTo'
I am getting an error on the "secondInstance test for ProjectTableID, which
is a nullable int (int?).
public class RacerComparer : IComparer<FieldName>
{
public int Compare(FieldName firstInstance, FieldName
secondInstance)
{
int result = 0;
result =
firstInstance.ProcessOrder.CompareTo(secondInstance.ProcessOrder);
if (result != 0) return (result); // if not equal, not need to
check Name
result =
secondInstance.ProjectTableID.CompareTo(secondInstance.ProjectTableID);
if (result != 0) return (result);
return result;
}
}
I can't even test for the null (HasValue), because I am getting the error on
the build.
How can I change this so that I don't get this error?
Thanks,
Tom