C#中的注释是什么?
注释用于解释代码。编译器将忽略注释条目。C#程序中的多行注释以/*开头,并以字符*/结束,如下所示。
多行注释
/* The following is a mult-line comment In C# /*
/*...*/被编译器忽略,并在程序中添加注释。
单行注释
// variable int a = 10;
以下是一个示例C#程序,显示了如何添加单行和多行注释-
示例
using System;
namespace Demo {
class Program {
static void Main(string[] args) {
/* I have started learning C# and
is my first program */
// displaying text
Console.WriteLine("Hello World");
Console.ReadKey();
}
}
}输出结果
Hello World
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短