-
November 2nd, 2007, 06:27 AM
#1
Something like a delegate!
Visual Studio 2005.
C# beginner
Experience: C/C++ (Visual C++)
Hello best programmers,
From my class I want to call a function which is in the Main(). The problem is, my class will be used in several application, so there must be a mechanism to call the same function without modifying the class.
So if I use my class in Application_1, I can use it in Application_2 too without modifying the class to suit in Application_2. This also means if I change the something in the class, I don't want all the applicationsources need to recompile, only the changed class.
So how can I do that if I want to call a function in the Main()?
If I use delegates, than I need somehow a reference to the MainForm class to call the needed function. Does somebody know how to do that in a neat way (or a professional way)? I mean such a way that if my class will be used in another application it still calls the same function in the MainForm() WITHOUT modifying the class (that makes my class protable).
Thank you.
Last edited by EmbeddedC; November 2nd, 2007 at 06:31 AM.
-
November 2nd, 2007, 09:13 AM
#2
Re: Something like a delegate!
Not sure I understood your post.
If you are looking to share one or more classes, how about creating a class library (dll) containing the class you wish to share. Then reference this library in each application that needs to use the class.
Before post, make an effort yourself, try googling or search here.
When posting, give a proper description of your problem, include code* and error messages.
*All code should include code tags
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|