成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

詳解ASP.NET注釋語句及服務器注釋

開發 后端
本文將介紹ASP.NET注釋語句,包括服務器端的注釋語句。良好的注釋能幫助開發人員更好的理解程序代碼,希望本文能對大家有所幫助。

服務器端ASP.NET注釋語句

允許您將ASP.NET注釋語句包括在 .aspx 文件的正文中。服務器端注釋元素的開始標記和結束標記之間的任何內容,不管是 ASP.NET 代碼還是文本,都不會在服務器上進行處理或呈現在結果頁上。

  1. <%-- commented out code or content --%> 

備注

ASP.NET服務器端注釋塊與傳統的語言特定注釋塊具有相同的用法(包括文檔和測試)。

和 <% %>塊中,可以使用正用于編碼的語言的注釋語法。

如果在 <% %>塊中使用服務器端ASP.NET注釋塊,則會出現編譯錯誤。

開始和結束ASP.NET注釋標記可以出現在同一行代碼中,也可以由許多被注釋掉的行隔開。

服務器端注釋塊不能被嵌套。

ASP.NET注釋示例

下面的示例說明被注釋掉的 HtmlButton 控件。

  1. <%-- <button runat="server" id="MyButton" OnServerClick="MyButton_Click"> 
  2.              Click here for enlightenment!  
  3.        button> 
  4.  --%>  

JScript 注釋

單行 JScript 注釋以兩個正斜杠 (//) 開始。以下是單行注釋(后跟一行代碼)的一個示例。

  1. // This is a single-line comment.  
  2. aGoodIdea = "Comment your code for clarity.";  
  3. 多行 JScript 注釋以正斜杠和星號 (/*) 開頭,以相反的順序 (*/) 結束。  
  4. /*  
  5. This is a multiline comment that explains the preceding code statement.  
  6. The statement assigns a value to the aGoodIdea variable. The value,  
  7. which is contained between the quote marks, is called a literal. A  
  8. literal explicitly and directly contains information; it does not  
  9. refer to the information indirectly. The quote marks are not part  
  10. of the literal.  
  11. */ 

如果試圖在一個多行注釋中嵌入另一個多行注釋,JScript 將以一種意想不到的方式解釋生成的多行注釋。標記嵌入的多行注釋結尾的 */ 將被解釋為整個多行注釋的結尾。因此,在嵌入的多行注釋后面的文本將被解釋為 JScript 代碼,并可能生成語法錯誤。

在下面的示例中,由于 JScript 將最里面的 */ 解釋為最外面注釋的結尾,因此第三行文本將被解釋為 JScript 代碼:

  1. /* This is the outer-most comment  
  2. /* And this is the inner-most comment */ 
  3. ...Unfortunately, JScript will try to treat all of this as code. */ 

建議將所有ASP.NET注釋語句編寫為單行注釋的塊。這樣就允許隨后用一個多行ASP.NET注釋來注釋大段代碼。

  1. // This is another multiline comment, written as a series of single-line comments.  
  2. // After the statement is executed, you can refer to the content of the aGoodIdea  
  3. // variable by using its name, as in the next statement, in which a string literal is  
  4. // appended to the aGoodIdea variable by concatenation to create a new variable.  
  5. var extendedIdea = aGoodIdea + " You never know when you'll have to figure out what it does."

或者還可以使用條件編譯安全有效地注釋大段代碼。

【編輯推薦】

  1. 淺析ASP.NET Web 安全性
  2. ASP.NET的Session State
  3. 淺析IsPostBack屬性ASP.NET
  4. ASP.NET構架與安全機制
  5. 概述ASP.NET水晶報表
責任編輯:彭凡 來源: CSDN
相關推薦

2009-07-29 13:42:25

ASP.NET注釋

2009-08-04 13:10:05

ASP.NET服務器控

2009-08-10 14:08:15

ASP.NET服務器控ASP.NET組件設計

2009-08-04 17:18:37

2011-07-12 15:17:02

ASP.net服務器控件

2009-08-03 18:00:00

ASP.NET服務器控

2009-08-10 14:25:33

ASP.NET服務器控

2009-07-28 10:43:23

Web服務器ASP.NET

2009-07-29 16:08:07

ASP和ASP.NET

2009-07-27 12:56:27

控件CheckBoxLASP.NET服務器

2009-08-04 13:39:43

ASP.NET 2.0

2009-08-04 15:13:38

2009-08-06 14:16:04

ASP.NET服務器控

2009-07-22 16:25:41

ASP.NET AJA

2009-07-24 10:14:22

ASP.NET開發

2009-07-28 16:57:50

ASP.NET Ses

2009-08-05 11:14:33

ASP.NET ISA

2009-07-29 12:55:44

ASP.NET身份驗證

2009-07-23 13:19:51

2009-08-28 09:58:20

ASP.NET Web
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 97久久久久久| 一区在线观看视频 | 免费观看一级特黄欧美大片 | 中文字幕在线一区二区三区 | 日韩在线免费 | 日韩在线不卡视频 | 色姑娘综合网 | 美女一区| 91久久国产综合久久91精品网站 | 色婷婷综合成人av | 成人免费淫片aa视频免费 | 男女羞羞视频免费 | 看片地址| 求个av网址| 人人看人人搞 | 日本精品视频在线 | 秋霞a级毛片在线看 | 精品国产一区二区三区久久影院 | 一级爱爱片 | 久久精品网 | 国产精品国产三级国产aⅴ中文 | 日韩欧美一区在线 | 欧美日日 | 日韩中文字幕一区二区三区 | 免费黄色日本 | 丁香综合| 欧美电影一区 | 国产在线精品一区二区三区 | 精品成人在线观看 | 亚洲午夜精品一区二区三区他趣 | 99亚洲国产精品 | 国产精品欧美一区二区 | 一区天堂| 久久五月婷 | 男人影音| 91精品国产91 | 欧美日韩视频在线 | 久久精品国产99国产精品 | 成人网在线观看 | 欧美电影网 | 欧美电影一区 |