2011-10-31 61 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 
相关问题