In VS, the difference between using and "Add reference" is vsusing.

Source: Internet
Author: User

In VS, the difference between using and "Add reference" is vsusing.

Reference indicates that you can use this Assembly, and add a using to facilitate your use of this Assembly, without the need to write the full name.

For example:
After referencing System. Windows. Form, you can use the MessageBox. Show () method;
But before you use using System. Windows. Form, you must use:
System. Windows. Form. MessageBox. Show ()
After you add using System. Windows. Form in front of the code, you can easily use it directly:
MessageBox. Show ()
That is, the usage of "class. Method"
Of course, I use static methods here. Other methods need to be instantiated first.
Anything you want to use must come from an assembly you reference,A reference is a reference of an assembly to another assembly;

A References B, indicating that A can work normally only when the B Assembly exists. Possible reasons include: resource, code, and so on. In short, if the B assembly cannot be found, assembly A cannot be started.
Using indicates a reference to a namespace in a code unit, so that your code uses the name in the namespace without a full name.

A little more, in fact, this principle is very simple, isn't it.

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.