这是什么意思? [英] What Does :: Mean?

查看:141
本文介绍了这是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没错正如标题所说,我觉得我一直在寻找在C#code,当我看到这一段时间回来,我从来没有把它在意,但到底是什么 :: 意味着C#。我觉得我看到的东西像 myVar的::的Process.Start()

Exactly as the title says, I think I was looking at c# code when I saw this a while back, I never took much notice of it, but what does :: Mean in c#. I think I saw something like myVar::Process.Start()

推荐答案

这是命名空间别名限定符 - 如果你使用的命名空间的别名:

It is the namespace alias qualifier - if you use namespace aliases:

using config = System.Configuration;

...

var value = config::ConfigurationManager.AppSettings["Somthing"];

这有助于当你有类型与在同一范围内的同名歧义。

It helps disambiguating when you have types with the same name in the same scope.

例如 - 如果你有几个类(一个用于家具,一个旅程的腿),无一不是在导入的命名空间,其结果是当您使用在code编译器无法分辨出哪一个你的意思,那么如果你有一个命名空间别名命名空间,你可以使用<别名> ::腿引用你的意思是确切类型

For example - if you have several Leg classes (one for furniture, one for the leg of a journey), and both are in imported namespaces, with the result that when you use Leg in your code the compiler can't tell which one you mean, then if you have a namespace aliases to the namespaces, you can use <alias>::Leg to refer to the exact type you mean.

有一个默认的别名 全球全球命名空间。

There is a default alias global for the global namespace.

这篇关于这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆