Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In C# what is best practice when setting up a project with dependencies (e.g. class library or separate files)

Tags:

c#

dll

Lets say I have two projects.

  • a main project that needs files from the secondary project (lets call this the library)
  • a project (the library) containing multiple files that I could use in my main project (lets say it has 100 classes available).

Now I could create a C# class library (.dll) and reference it from my main project. And all the functionality is available.

But what if my main project only needs 25 classes from the total 100 available. For the current situation that is an overhead and in my opinion I would be better of with direct file referencing from the other projects.

What would be the better of those two options (.dll or referencing the source code files in the library) and why?

like image 232
Blaatz0r Avatar asked Mar 18 '23 09:03

Blaatz0r


1 Answers

I would say create a library (dll) and reference that. In that way the library can be used by multiple projects and you will have a single code base maintaining the library.

There is always that specific situation where you might end up in referencing the whole library and only using one class out of it.

like image 57
RFerwerda Avatar answered Apr 26 '23 18:04

RFerwerda