❔ System.Reflection
So I got a dll file that contains a class and its interface. What I want is to extract the class as an item than an instance.
So for example, if I have a dynamic variable of name "temp" and I wish to put the class which I extracted from dll by looping over GetExportedTypes() of the particular Assembly and putting value into "temp" when I get the preferred class, I want to be able to use it like
temp instance_of_clas = new temp();
like that, is that possible? if so, how to do it? if not, is there any alternative method (other than using Activator.CreateInstance()). My aim is not to get the instance, my aim is to get the class in such a way that I can create an instance using it.
5 Replies
That sounds like exactly what Activator.CreateInstance is for
i konw we can create an intance, thats not what i meant
tahts now what i want at all
i said i want a variable which i can use it like the class name
like exactly like that
not creating an instance
my main aim is to use it for inheritance of a class i am going to create
so like
That's not how reflection works. Inheritance is a compile time concept. Reflection is a runtime concept.
i see, so icannot do anything like that sort
Thanks for that information, i was trying to figure that out for past 4 hours
so is it possible to like get all the methods and its body of a class and put it in a txt file?
is that possible
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.