Link to home
Start Free TrialLog in
Avatar of jackjohnson44
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).FullName;
string evAssembly = typeof(my.classname).Assembly.FullName;

where my.classname is actually a class  
Avatar of AlfredRobot
AlfredRobot
Flag of Canada image

Avatar of jackjohnson44
jackjohnson44

ASKER

Thanks, but I don't understand that at all.  Can you please explain?
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.
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!