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