C #3.0 Study Notes (2) Introduction to namespaces and assembly

Source: Internet
Author: User

1. What is a namespace? What is assembly?

Namespace: the compilation unit used to organize and reuse code. It effectively avoids the issue of class life conflicts caused by using two or more assemblies in the same program.

Assembly :~ Is an exe executable or DLL file. It contains the Common Intermediate Language of the program.

2. Assembly generation process?

3. What is the namespace declaration syntax?

Namespace SimpleNamespce

{

TypeDeclarations;

}

Note: 1. namespace is a keyword.

2. SimpleNamespce is the namespace name.

4. What are the namespaces and using commands?

1. Use the using command to avoid repeated write of fully qualified names.

2. The using command must be placed at the top of the source file before any type declaration.

3. They are applied to all namespaces in the current source file.

5. What is the comparison between the using command and the using command?

Do not use the using command:

Class WidgetsProgram

{

Static void main ()

{

MyCorp. SuperLib. SquareWidget sq = new MyCorp. SuperLib. SquareWidget ();

....

}

}

Use the using command:

Using MyCorp. SuperLib

Class WidgetsProgram

{

Static void main ()

{

SquareWidget sq = new SquareWidget ();

....

}

}


The author's wheat forever.

Related Article

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.