I am trying to constrain the parameter of a method call to be one of 2 different classes. I don't know if it is possible or do I have to inherit both classes from a common base class.
Here's what I am using so far but I want to make this type safe:
public static AdoptionApplicationCollection GetApplicationsByApplicant (object applicant)
{
if (applicant.GetType() == typeof(Person))
{
// blah
}
else if (applicant.GetType() == typeof(Organization))
{
// blah
}
// A whole lot more blah
}
I'd like to make applicant a generic of type Person or Organization.