C#?程序通用結(jié)構(gòu)
C# 程序由一個或多個文件組成。 每個文件均包含零個或多個命名空間。 一個命名空間包含類、結(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
{
}
}
}
前面的示例使用頂級語句作為程序的入口點。 C# 9 中添加了此功能。 在 C# 9 之前,入口點是名為 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)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
C#設(shè)計模式實現(xiàn)之生成器模式和責任鏈模式
學完設(shè)計模式之后,你就感覺它會慢慢地影響到你寫代碼的思維方式,下面這篇文章主要給大家介紹了關(guān)于C#設(shè)計模式實現(xiàn)之生成器模式和責任鏈模式的相關(guān)資料,需要的朋友可以參考下2021-08-08
c# Selenium爬取數(shù)據(jù)時防止webdriver封爬蟲的方法
這篇文章主要介紹了c# Selenium爬取數(shù)據(jù)時防止webdriver封爬蟲的方法,幫助大家更好的理解和使用c#,感興趣的朋友可以了解下2021-01-01

