| |

VerySource

 Forgot password?
 Register
Search
View: 9|Reply: 3

Problems with referencing assemblies and using namespaces

[Copy link]

1

Threads

2

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-3-22 18:00:01
| Show all posts |Read mode
What is the difference between using assemblies and referencing assemblies under VS Project Manager? ? I found that using namespaces still can't use the namespace's classes.
Reply

Use magic Report

0

Threads

5

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-6-30 19:15:01
| Show all posts
The reference indicates that you can use this assembly, and adding a using is to facilitate your use of this assembly, without writing the full name.
Such as:
After referencing System.Windows.Form, you can use the MessageBox.Show() method
But before you use System.Windows.Form, you must use it like this:
System.Windows.Form.MessageBox.Show()
When you add using System.Windows.Form in front of the code, you can easily use it directly:
MessageBox.Show()
The usage of "class.method"
Of course, I use static methods here, other methods need to instantiate the class first. Talk too much.
The simple point is: all you want to use must come from an assembly that you reference. Of course, many namespaces are often in an assembly, and you don’t need to refer to the same assembly multiple times for multiple namespaces.
Reply

Use magic Report

0

Threads

13

Posts

11

Credits

Newbie

Rank: 1

Credits
11

 China

Post time: 2020-7-1 13:45:01
| Show all posts
There are many namespaces in an assembly
You can use the code in these namespaces by referring to an assembly, but write the full name, like ls said to write similar code such as System.Windows.Form.MessageBox.Show().
Reply

Use magic Report

1

Threads

2

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

 Author| Post time: 2020-7-3 10:00:01
| Show all posts
Thank you guys`
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list