VS, using and "Add Reference" differences

Source: Internet
Author: User

The reference indicates that you can use the assembly, and a using is used to make it easier for you to use the assembly without having to write the full name.

such as:
after referencing System.Windows.Form, you can use the MessageBox.Show () method;
but before you use the System.Windows.Form, you have to do this:
System.Windows.Form.MessageBox.Show ()
when you add a using System.Windows.Form to your code, you can easily use it directly:
MessageBox.Show ()
The use of the "class. Method"
Of course, I use static methods here, other methods need to instantiate class first.
whatever you want to use must come from one of the assemblies you reference ,A reference is a reference to another assembly by an assembly;

A refers to B, which indicates that a must have a B assembly in order to function properly, possibly for the following reasons: Resource, code, and so on; If you do not find this Assembly B, assembly A will fail to start.
Using, in a unit of code, represents a reference to a namespace that allows your code to use the name in that namespace without the need for a full name.

Speak more, in fact this truth is very simple is not.

Vs, using and add reference differences

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.