I set up a method to pass a type as a parameter
private void SomeMethod(System.Type type)
{
//some stuff
}
Is there a way to enforce the type so that you can only pass in types that inherit from a specific base class?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
there are a lot of possibilities…
instance-based:
becomes
or
OR with generic functions:
call that:
for more info about constraints:
http://msdn.microsoft.com/en-us/library/d5x73970(v=vs.80).aspx