C#教程
C#控制语句
C#函数
C#数组
C#面向对象
C#命名空间和异常
C#文件IO
C#集合
C#多线程
C#其它

C# 注释

C# 注释

C# 注释是不由编译器执行的语句。 C# 编程中的注释可用于提供代码、变量、方法或类的解释。借助注释,您还可以隐藏程序代码。
C# 中有两种类型的注释。
单行注释 多行注释

C# 单行注释

单行注释以//(双斜线)开头。我们来看一个 C# 中单行注释的例子。
using System;
   public class CommentExample
    {
       public static void Main(string[] args)
        {
            int x = 10;//Here, x is a variable  
            Console.WriteLine(x);
        }
    }
输出:
10

C# 多行注释

C# 多行注释用于注释多行代码。它被斜线和星号(/* ..... */) 包围。让我们看一个 C# 中多行注释的例子。
using System;
   public class CommentExample
    {
       public static void Main(string[] args)
        {
            /* Let's declare and 
		  print variable in C#. */ 
	        int x=20;
            Console.WriteLine(x);
        }
    }
输出:
20
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4