2011-10-31 27 views
-1

在C#xml註釋中,以下標記之間有什麼區別?c和代碼標記之間的區別

1. <c> 
2. <code> 
+0

你也許在XML代碼註釋的意思(對於智能感知?) –

+0

我懷疑downvotes是因爲原來的問題是不明確的。 – Stormenet

+0

它甚至沒有提及xml評論;基於之前的asp.net標籤(現在已被刪除)的假設是,您正在討論html,其中只有其中一個標籤甚至被定義爲 –

回答

4

假設你正在談論tags in xml commentsc就像StackOverflow的反單引號,而code更像代碼塊。

/// <summary> 
/// This is the <c>SomeMethod</c> method of the <c>Program</c> class. 
/// </summary> 
/// <param name="s">A string.</param> 
/// <example> 
/// You can use this method like this: 
/// <code> 
/// string x = SomeMethod("foobar"); 
/// Console.WriteLine(x); 
/// </code> 
/// </example> 
static string SomeMethod(string s){ 
    throw new NotImplementedException(); 
} 
+0

+ 1的鏈接和非常具有描述性的答案。謝謝。 – Pankaj

2
<c>Your code sample.</c>  

指示的代碼短片段。您將使用c標籤在結果​​文檔中引起對特定單詞,短語或代碼的注意。你將嵌套c標籤在其他標籤。

<code>Your code sample.</code> 

代碼標記與標記類似,但它旨在說明真實的代碼使用示例。代碼標籤通常被包含在標籤集中(見下文)。

2

如果您的意思是代碼註釋,那麼<code>(通常在<example>中使用)代表多行說明性代碼,其中<c>代表只用一個代碼字體書寫的單個術語。

要使用計算器/降價作爲對比,他們是完全一樣的paragrah中間inline code,VS

a multi-line 
code sample that 
appears formatted separately 
相關問題