I have a function that has Type Parameter.
public static object SetValuesToObject(Type tClass, DataRow dr)
{
//
.............
//
return object
}
I have no idea how to pass a class as parameter for this function. Here i want to pass parmeter Class "Product".
I tried this
SetValuesToObject(Product,datarow);
But it doesn't work. How could i do this?
The typeof
keyword when you know the class at compile time.
SetValuesToObject(typeof(Product),datarow);
You can also use object.GetType()
on instances that you don't know their type at compile time.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments