C#?程序通用結(jié)構(gòu)
C# 程序由一個(gè)或多個(gè)文件組成。 每個(gè)文件均包含零個(gè)或多個(gè)命名空間。 一個(gè)命名空間包含類、結(jié)構(gòu)、接口、枚舉、委托等類型或其他命名空間。 以下示例是包含所有這些元素的 C# 程序主干。
// A skeleton of a C# program using System; // Your program starts here: Console.WriteLine("Hello world!"); namespace YourNamespace { class YourClass { } struct YourStruct { } interface IYourInterface { } delegate int YourDelegate(); enum YourEnum { } namespace YourNestedNamespace { struct YourStruct { } } }
前面的示例使用頂級(jí)語(yǔ)句作為程序的入口點(diǎn)。 C# 9 中添加了此功能。 在 C# 9 之前,入口點(diǎn)是名為 Main 的靜態(tài)方法,
如以下示例所示:
// A skeleton of a C# program using System; namespace YourNamespace { class YourClass { } struct YourStruct { } interface IYourInterface { } delegate int YourDelegate(); enum YourEnum { } namespace YourNestedNamespace { struct YourStruct { } } class Program { static void Main(string[] args) { //Your program starts here... Console.WriteLine("Hello world!"); } } }
到此這篇關(guān)于C# 程序通用結(jié)構(gòu)的文章就介紹到這了,更多相關(guān)C# 程序通用結(jié)構(gòu)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
C# 實(shí)現(xiàn)截圖軟件功能實(shí)例代碼
這篇文章主要介紹了C# 實(shí)現(xiàn)截圖軟件功能實(shí)例代碼,需要的朋友可以參考下2017-06-06

C#實(shí)現(xiàn)獲取枚舉中元素個(gè)數(shù)的方法

C#實(shí)現(xiàn)在Form里面內(nèi)嵌dos窗體的方法

C#五類運(yùn)算符使用表達(dá)式樹(shù)進(jìn)行操作

WPF ProgressBar實(shí)現(xiàn)實(shí)時(shí)進(jìn)度效果

通過(guò)LinQ查詢字符出現(xiàn)次數(shù)的實(shí)例方法