日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > C# >内容正文

C#

c# 中关键字_C#中的“使用”关键字

發(fā)布時(shí)間:2023/12/1 C# 52 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c# 中关键字_C#中的“使用”关键字 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

c# 中關(guān)鍵字

Prerequisite: Namespace in C#

先決條件: C#中的命名空間

If you want to include namespace in a program then we need to use using keyword. For example we use Console class which is defined in System namespace that’s why we need to include System namespace using using keyword.

如果要在程序中包含名稱空間,則需要使用using關(guān)鍵字。 例如,我們使用在System名稱空間中定義的Console類,這就是為什么我們需要使用using關(guān)鍵字包含System名稱空間的原因。

If we want to use Console class without include then we can also access it with the help of . (dot) operator like that:

如果我們想使用不包含include的Console類,那么我們也可以借助來訪問它。 像這樣的(點(diǎn))運(yùn)算符:

System.Console.WriteLine("Hello World");

Example:

例:

using System; using System.Collections;using namespace1; using namespace2;namespace namespace1 {class ABC{public void fun(){Console.WriteLine("Inside Namespace1");}} }namespace namespace2 {class XYZ{public void fun(){Console.WriteLine("Inside Namespace2");}} } class Program {static void Main(){ABC OB1 = new ABC();XYZ OB2 = new XYZ();OB1.fun();OB2.fun();} }

Output

輸出量

Inside Namespace1Inside Namespace2

Read more: Nested Namespace in C#

: C#中的嵌套命名空間

翻譯自: https://www.includehelp.com/dot-net/using-keyword-in-c-sharp.aspx

c# 中關(guān)鍵字

總結(jié)

以上是生活随笔為你收集整理的c# 中关键字_C#中的“使用”关键字的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。