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