class A
{
}
class B : A
{
}
void method(A that is not a B argument) {}
void generic_method(generic_class<A that is not a B> generic_argument) {}
void params_method(params A that is not a B[] params_arguments) {}
Is there any syntactical way to do this? i realize that i could just do
if(argument is B)
throw new ArgumentException("argument cannot be a B", "argument");
at the beginning of the first method, and do that in a foreach for the second and third, but I'm wondering if there is some keyword or OOP concept that accomplishes this better.