variable as type of generic (method)
-
Hi! so i've got this generic method:
UserControl _control; public void InitializeSomething(WorkItem workItem) where Tclass : UserControl { _control = workItem.Items.AddNew(); }
my goal is to call this method sth like this:Type someType = typeof(someOtherObject); someObj.InitializeSomething(WorkItem);
but this of course won't work.. my question is: is it possible to pass variable containing some type as Tclass for generic?! thanks for any help!!!life is study!!!
-
Hi! so i've got this generic method:
UserControl _control; public void InitializeSomething(WorkItem workItem) where Tclass : UserControl { _control = workItem.Items.AddNew(); }
my goal is to call this method sth like this:Type someType = typeof(someOtherObject); someObj.InitializeSomething(WorkItem);
but this of course won't work.. my question is: is it possible to pass variable containing some type as Tclass for generic?! thanks for any help!!!life is study!!!
I don't really get what you're aiming for... Doe you want to create a collection of controls which are derived from some kind of type?
.: I love it when a plan comes together :. http://www.zonderpunt.nl
-
I don't really get what you're aiming for... Doe you want to create a collection of controls which are derived from some kind of type?
.: I love it when a plan comes together :. http://www.zonderpunt.nl
-
mmh.. well, for example List<>.. inside the <> you have to put class name.. and my aim is to pass this class name through some variable.
life is study!!!