B
bladethinker
Hello - I have a method that will help compare nullable booleans. It
is pasted below. I'd like to do the same for DateTime. Instead of
copying most of the code for a DateTime method, I'd like to create a
method that will accept any kind of nullable type. Yet I'm not sure
how to code the args and the rest of the code. Does anyone know how to
do that? Thanks! --bladethinker
protected virtual int CompareNullableBoolean(bool? objectX,
bool? objectY)
{
if (objectX == objectY)
{
return 0;
}
if (!objectX.HasValue && !objectY.HasValue)
{
return 0;
}
if (!objectX.HasValue)
{
return 1;
}
if (!objectY.HasValue)
{
return -1;
}
return objectX.Value.CompareTo(objectY.Value);
}puroli
is pasted below. I'd like to do the same for DateTime. Instead of
copying most of the code for a DateTime method, I'd like to create a
method that will accept any kind of nullable type. Yet I'm not sure
how to code the args and the rest of the code. Does anyone know how to
do that? Thanks! --bladethinker
protected virtual int CompareNullableBoolean(bool? objectX,
bool? objectY)
{
if (objectX == objectY)
{
return 0;
}
if (!objectX.HasValue && !objectY.HasValue)
{
return 0;
}
if (!objectX.HasValue)
{
return 1;
}
if (!objectY.HasValue)
{
return -1;
}
return objectX.Value.CompareTo(objectY.Value);
}puroli