Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing code 1

Status
Not open for further replies.

TiltingCode

Programmer
Apr 10, 2009
61
US
I think this is an easy answer... (For someone with experience)
I have two applications and I want them to use the same function. Naturally I don't want to copy and paste the code from one application to the other.

What do I need to do and how do I do it? I think I need to create a class but haven't found anything that shows me what to do or how to do it.

Please help!
 
Is this a simple case of just adding a class to a DLL I've already created?
 
in your new project just reference your dll??

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
I would be cautious of creating a "common" or "utilities" assembly to use across multiple applications. It will become a dumping ground for random functions. managing dependencies can become a nightmare (dll hell). You will begin to accumulate a number of functions that not every application needs.

There is only 1 time I would recommend this.
1. The projects are related to the same solution/application.
2. The functionality is complex.

other than that, I would duplicate the functionality across projects. It will be easier to maintain over time and reduces the number of dependencies.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
I would add an alternative condition: that the functionality is both likely to be commonly useful and unlikely to change.

An example that I use is separating the various parts out of a path/file/extension string.
 
I wouldn't, it's just another dependency. I would copy the class into the next project that needed it. much simpler that creating a FileHelper assembly. I would have a FileHelper class in any project that needed it, and even then, only the functions that the system explicitly requires.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Thanks for the input. It appears you've saved me from creating something I'd someday regret.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top