Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

Dynamic Instantiation of Class

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kiran - 03 Aug 2005 11:51 GMT
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
hB - 03 Aug 2005 12:20 GMT
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.

---
hB

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.