I am trying to create a method in VS 2003 that validates an object argument
is of the proper type and within a range of values.
I am trying to use a Type to define the casting and object type for the
validation. But I get and error of "The type or namespace name 't' could not
be found (are you missing a using directive or and assembly reference?) on
the "is" operator and the casting operation.
An example of the method follows. The "is" operator is defined as
expression is type
"t" is a type.
private bool Validate( object data, object min, object max, Type t )
{
if( data != null && data is t )
{
if( ( t )data >= ( t )min || ( t )data <= ( t )max )
{
return true;
}
}
return false;
}
Is their any way to do this in VS 2003. I know I can use generics with
2005, but hat is not an option at this time.
--
Jim