C# 中的注释
注释用于解释代码。编译器会忽略注释条目。C# 程序中的多行注释以 /* 开头并以字符 */ 结尾,如下所示。
多行注释
/* The following is a multi-line comment In C# /*
编译器会忽略 /*...*/,它用于在程序中添加注释。
单行注释
// variable int a = 10;
以下是显示如何添加单行注释和多行注释的 C# 程序示例 -
示例
using System;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
/* I have started learning C# and
this is my first program */
// displaying text
Console.WriteLine("Learn C# now!");
Console.ReadKey();
}
}
}输出
Learn C# now!
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 程序设计
C++
C#
MongoDB
MySQL
JavaScript
PHP