02-25 How to use new class libraries

Source: Internet
Author: User

As mentioned before, be sure to differentiate between namespaces and class libraries:

1) Namespace: Also called the assembly, you can see the "container" of the class, can contain more than one class

2) Class Library: Many kinds of classes together, it is equivalent to a lot of files to form a compressed package.

Create a new class library project that ends with a. dll, and VS automatically adds a Class1.cs file to the project, either writing code in such a file, or adding a new class. There is no limit to the number of classes that can be accommodated in a class library project, but only classes that declare public can be used by outsiders.

"Note" "namespace" is a logical concept, his physical vector is "assembly", which is embodied as "DLL" (or EXE) file, in VS, you can create a class library type of project to build the assembly.

An assembly can contain multiple namespaces, and a namespace can be distributed across multiple assemblies.

To create a new class library project, use the following method:

First step: Right-click "solution" to add a new item to the DLL end of the class library file.

Step Two:

The third step: when the Class Library project is built, it needs to be generated, otherwise it will not work.

Fourth Step:

Fifth step: In the main function, add a reference to the self-built class library.

02-25 How to use new class libraries

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.