技术开发 频道

C# 程序的通用结构

  【IT168 技术文档】C# 程序可由一个或多个文件组成。每个文件都可以包含零个或零个以上的命名空间。一个命名空间除了可包含其他命名空间外,还可包含类、结构、接口、枚举、委托等类型。以下是 C# 程序的主干,它包含所有这些元素。

// 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 YourMainClass

  {
static void Main(string[] args)

  {
//Your program starts here... }

  } }

 

 

 

0
相关文章