Hey guys,
I want to pass in the Type of an class to a function, and the class object to a generic function.
I need to be able to cast to that Type (of class) so i can access the class's methods.
Something Like:
void GenericFunction(Object obj, Type type)
{
(type)obj.someContainer.Add(1);
}
would implementing an interface for these classes and then casting to that interface work? if so, could someone give an example?
I've been googling for the past few hours, and I've never had to do this before.
can someone shed some light?
Thanks!