Reuseable Class Library

C

Curt Emich

I'm planning to create a class library containing code that I can resuse in
all of my apps. I would probably put these classes into a namespace that
contained my company name and then the word "reuseable".

Would I put these classes in their own separate file? If so, how would I
include it in each respective project? The references I see so far in C#
are all .dll files, but these would just be text I guess.

Can someone shed some light on this for me? Thanks!
 
P

Peter Rilling

Depends on how you want to reuse them. There are two alternative.

1) Consider your reusable code as a blackbox.
2) Allow other projects to use the source and modify it as needed.

If you wanted your code to be a blackbox, you would simply have a project
that contains all the code libraries you want. The resulting binary would
then be used in other projects. All you have to do is add a reference to
your library assemblies in each project. You may also need to include the
binaries with your projects unless you plan to add them to the GAC.

If you want the code to be modifiable, then you can simply just add those
code files to your other projects.
 
C

Curt Emich

I probably want to go "black box". So I would just compile a bunch of
.cs files into a .dll?
 
G

Guest

Yeah thats it. If you have VS just start up a class library project and chuck in as many .cs files as you want into the solution and hit compile
Then in the project/solution that will use you "blackbox" go to references -> add and browse to your .dll
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top