jackjohnson44
asked on
c# how do I pass a class in as a parameter to a function
I have a function that uses the lines below. I would like to pass in the class to the function instead of how it is hardcoded now. Is this possible?
string evClass = typeof(my.classname).FullN ame;
string evAssembly = typeof(my.classname).Assem bly.FullNa me;
where my.classname is actually a class
string evClass = typeof(my.classname).FullN
string evAssembly = typeof(my.classname).Assem
where my.classname is actually a class
ASKER
Thanks, but I don't understand that at all. Can you please explain?
ASKER
I am not trying to load an assembly either. I plan to set everything to a variable, and don't mind presetting it and not using it.
I want
var x = class1
var y = class2
If I want to use x or y, I just use them. I don't need to load anything at runtime. I just don't want to have to have two different versions of the same function.
I want
var x = class1
var y = class2
If I want to use x or y, I just use them. I don't need to load anything at runtime. I just don't want to have to have two different versions of the same function.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
https://www.experts-exchange.com/questions/20967282/C-Class-Name-as-parameter-Object.html