Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use a C# Class Library in a project?

Tags:

c#

class

I've created a new Class Library in C# and want to use it in one of my other C# projects - how do I do this?

like image 635
Nosrama Avatar asked Aug 04 '09 15:08

Nosrama


People also ask

How do you use AC for the first time?

For most central air systems, the process is simple. Simply move the switch on your thermostat from “Heat” to “Cool”. If your system was off entirely, you may need to move the switch from “Off” to “Cool” instead. Once you turn your system on, be sure to close any open windows to conserve energy.

How do you use AC for cooling?

Keep the doors and windows closed when the AC is on. Avoid opening and closing the doors frequently to prevent the cool air from escaping the room. Prevent direct sunlight from entering the room. Use curtains, blinds and shades to keep the room cool.

What is the most efficient way to use air conditioning?

ACEEE estimates that air conditioners use 3% to 5% less energy for every degree you raise the thermostat. To get the best energy savings, leave your thermostat set at 78 degrees or higher while you're out.


1 Answers

Add a reference to it in your project and a using clause at the top of the CS file where you want to use it.

Adding a reference:

  1. In Visual Studio, click Project, and then Add Reference.
  2. Click the Browse tab and locate the DLL you want to add a reference to.
    NOTE: Apparently using Browse is bad form if the DLL you want to use is in the same project. Instead, right-click the Project and then click Add Reference, then select the appropriate class from the Project tab:
    enter image description here
  3. Click OK.

Adding a using clause:

Add "using [namespace];" to the CS file where you want to reference your library. So, if the library you want to reference has a namespace called MyLibrary, add the following to the CS file:

using MyLibrary; 
like image 187
Michael Todd Avatar answered Oct 08 '22 05:10

Michael Todd