I get a compiler error when Trying to use a generic with as. Since i can't do it the way I want to, what is a better way..? I wanted to check through 5-6 types, figuring i can use one method and see if it is null or not.
T CheckIsType<T>(Thing thing)
{
return thing as T;
}
exact error text:
Error 1 The type parameter 'T' cannot be used with the 'as' operator because it does not have a class type constraint nor a 'class' constraint.