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
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式語言
C++
C#
MongoDB
MySQL
Javascript
PHP