Referring the code below:
Void Work(object obj,Type objType)
{
//code to downcast obj to type speciied in objType
}
I am new to Reflections in C#. I'll really appreciate if someone can guide me how can I downcast obj to the type specified in objType. Is is possible, or my approach is wrong?
Refering to Casting a variable using a Type variable,
public T CastExamp1<T>(object input)
{
return (T) input;
}
could be a possible solution, but how do I pass the Type in objType variable to ?