< Day Day Up > |
TechniqueCreate a new project by choosing New, Project from the main menu. Select Visual C# Projects from the list of project types. In the list of project templates, select the Class Library template. To use an object within a class library, right-click on the client project name in Solution Explorer and select Add Reference. Select the .NET tab in the Add Reference dialog, shown in Figure 2.4, and then click the Browse button. Locate the class library that contains the classes you want to use. Figure 2.4. To use a type defined in a class library, you must create a reference to it in your project.
CommentsClass libraries allow you to put into a single shared package code that many different modules can use. By itself, a class library cannot run because it is not an executable. It is simply a container of resources and types that can be referenced. The .NET Framework contains several class libraries known collectively as the FCL, or Framework Class Libraries. Up to this point in the book, you have been using types defined within the System library, which is contained within the System.dll assembly. The .NET Framework has many more class libraries, which you will no doubt be familiar with by the end of this book. |
< Day Day Up > |