| 步骤 3. 程序结构
既然我们已经构建了一个简单的 Hello World 应用程序,那么就让我们停下来分析一下 Visual C# 应用程序的基本组成部分。 源代码注释字符 // 将行的剩余部分标记为一个注释,这样 C# 编译器就会忽略它。另外,/* 和 */ 之间的代码也会被当作注释。 // This line is ignored by the compiler.
/* This block of text is also ignored by the Visual C# compiler. */ Using 指令。NET 框架为开发人员提供了许多有用的类。例如,Console 类处理对控制台窗口的输入和输出。这些类是按照层次树的形式组织的。Console 类的完全限定名实际上是 System.Console.其他的类包括 System.IO.FileStream 和 System.Collections.Queue. using 指令允许您在不使用完全限定名的情况下引用命名空间中的类。以斜体突出显示的 代码应用了 using 指令。 using System; !--判断阅读权限-->!--判断是否已经扣点-->class Class1 { static void Main(string[] args) { System.Console.WriteLine ("Hello, C#.NET World!"); |
