In the name space
Using System is a reference to a namespace,
Namespace MyName What's this for?
---------------------------------------------------------------
Just be happy.
Like your name Vfan Yan.
So
Namespace Vfanyan is the definition of your name.
And I want to do something with you, and I can
Using Vfanyan.
In Java, namespace is called package
---------------------------------------------------------------
Vfan Yan
I see namespace the same name in multiple programs,
such as A.cs
Using System
Namespace MyName
.
.
.
B.cs
Using System
Namespace MyName
.
.
.
What's going on in this situation?
---------------------------------------------------------------
Just be happy.
Multiple files can be inside, multiple file combinations can also be inside
namespace is equivalent to specifying an addressing method.
Tell everyone where you can find me.
But namespace is not equivalent to physical form, they can be in different files (which refers to output files, such as. dll or. exe), and in the same assembly can also have multiple namespace.
Unlike Java, the package in Java corresponds to the directory, so if you use java.io.****, you have to build a three-tier directory, Special trouble: (
Vfan Yan
I don't understand that.
If other programs are using this namespace, why not use it and namespace it again? Does that mean namespace myname=using myname?
Just be happy.
Not correct
namespace==, you give yourself a name.
using==, I called your name.
Vfan Yan
look!
A.cs
Using System
Namespace MyName
.
.
.
B.cs
Using System
Namespace MyName
.
.
.
C.cs
Using System
Using MyName
Does the myname mean A.cs or B.cs?
---------------------------------------------------------------
Just be happy.
I should say so.
The group in the namespace== newspaper
using== use all of the people in this group
So a declares that I am a person of the MyName group, and B is a person of the MyName group, then C declares the person who uses the MyName group, then it can use either B or a.
namespace is not a class, nor is it an object, it is just an inclusion of class and other types of declarations, in order to make these classes more orderly, more conducive to others to find. Exclude duplicate names to the maximum extent possible.
You are Dev-club's Vfan Yan, but do not rule out Sina also has a vfan Yan not you.
So your full name is Dev-club.vfanyan.
Namespace Dev-club
{
public class vfaneyan{
}
public class just be happy.
}
public class Bird {
}
}
Note: The above examples are not very accurate, because the class is actually in reality is the object:
---------------------------------------------------------------
Vfan Yan
I understand that, right?
A.cs
Using System
Namespace MyName
{
public class vfanyan{
}
}
B.cs
Using System
Namespace MyName
{
public class just be happy.
}
public class Bird {
}
}
C.cs
using System;
Using MyName;
Vfanyan new_vfanyan=new Vfanyan ()
Happy is good new_ happy just good =new happy ()
Bird New_ bird = New Bird ()
Just be happy.
Right
But there's something wrong with C, your statement must be contained in a method (or attribute), and those methods must be contained in a class, and the class has to be contained within a namespace.
---------------------------------------------------------------
Vfan Yan
What does the namespace here mean?
A.cs
Using System
Namespace MyName
{
public class vfanyan{
}
}
B.cs
Using System
Namespace MyName
{
public class New_vfanyan:vfanyan
Just be happy.
Two different methods
1. In the same project
2. In two project, but Project B is already add refrenerce the project where a is located or the assembly of its output
You take a closer look at the source code
There may be many other namespace in a class, but a class must be included in only one namespace.
---------------------------------------------------------------
Vfanyan
See, it's in the same project, and it's finally Csc/target:library/out:myname.dll A.cs B.cs, is this it?
---------------------------------------------------------------
Just be happy.
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.