Dynamic Instantiation of Class

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a C# class file, whose name and path are written in an xml file.
This class file is not part of any assembly. The path and name of the class
can change and it will be updated to the xml file.

Now I need to write a program which instantiates the class and invokes
methods of that class. (Say I need to add that class to current project,
Instantiate it, Invoke methods dynamically through code?). I need to write a
web based solution

Is there any way of achieving this functionality
 
Lets say you have a file 'csharpcls.cs' (else it must be an assembly)
alongwith the path it resides.
Your code at runtime locates it, compile it, gets the generated
Assembly Dll.
and (suppose) You have some project (proj / solution) file then you go
in there add reference by writing to the proj (text) file (else add the
name and path of c# file from the xml file to your some other new
project file), then perhaps your work is almost done.
Now comes the part, which function of the class you are going to call?
do you have a base interface?
IBaseInterface : IRuntimeClass
Then all (c# dynamicly defined) classes implement this their way, and
you just call functions of this interface perhaps in your some other
new project in which you have include the c# class file.
Or you can get all funciton from the Reflection from the newly
generated class, but which funciton are you going to call and how (liek
what sequence)?
Perhaps write some code (psuedo code) in XML file alongwith the c#
class, to how to use it.

This might be helpful.
 
Back
Top