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
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP