C# 注释
Code
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
//public string testStr = " Hello ";
protected void Page_Load(object sender, EventArgs e)
{
/*
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
*/
}
/// <summary>
/// Test Function
/// </summary>
/// <param name="i">参数i , (int)</param>
/// <returns>返回string , (string)</returns>
public string GetStr(int i)
{
return i.ToString();
}
}
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
//public string testStr = " Hello ";
protected void Page_Load(object sender, EventArgs e)
{
/*
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
*/
}
/// <summary>
/// Test Function
/// </summary>
/// <param name="i">参数i , (int)</param>
/// <returns>返回string , (string)</returns>
public string GetStr(int i)
{
return i.ToString();
}
}
//public string testStr = " Hello "; -- 这个是单行注释
/* ....*/ 这个是多行注释。
3个斜杠: ///
当我们完成一个完成一个函数定义后,在函数的头部上输入三个///,则会自动出现如下的注释:
/// <summary>
/// Test Function
/// </summary>
/// <param name="i">参数i , (int)</param>
/// <returns>返回string , (string)</returns>
这个注释主要是用来生成doc文档。(绿色文字部分需要自己添加。)