如何在 C# 中編寫單行註釋?


如果您希望新增僅限於單行的註釋,請使用單行註釋 −

// variable
int i = 20;

以下是一個 C# 示意程式,演示如何新增單行註釋 −

示例

 線上演示

using System;

namespace Demo {
   class Program {
      static void Main(string[] args) {

         // display text
         Console.WriteLine("Hello World");
         Console.ReadKey();
      }
   }
}

輸出

Hello World

更新時間:20-Jun-2020

223 瀏覽量

啟動你的職業

完成課程,獲得認證

開始
廣告
© . All rights reserved.