Hi all, I was wondering, is there also a classloader in C#? I know that Java has it; if there isn't a classloader in C#, how would one load classes during runtime? If there is a classloader, how do I use it? I mean can someone show me an example please :D

Recommended Answers

All 4 Replies

By using reflection...

I'm still a bit lost. I've read that Reflections allow users to read and modify application assemblies and its metadata but I'm still uncertain as to how I would load a class dynamically...
On the site CodeSource.net they give code for loading a binary file, but I want to be able to load a class during runtime. Suppose that the class name is specified in a file, for example an xml file:

<driver>
<id>RX201</id>
<class>WaveTrendSensor</class> 
</driver>

So I'd want to create a WaveTrendSensor object but how do I load the appropriate class?

I don't know really if you can create object from class @ runtime and this class in text or xml file but you can work around this problem by creating assembly @ runtime and call this assembly by reflection. This solution if and only if Reflection don't create object from class @ runtime

commented: Thanks for the help man! :) +2

Oh gosh, it's moments like this that I wish I could just use Java. Thanks for the help Ramy!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.