标签: xml-documentation

哪个C#xml文档注释标记用于'true','false'和'null'?

哪个C#xml文档注释标记用于文字true,falsenull

在Microsoft自己的文档中,这些文字以粗体显示.例如,属性ArrayList.IsFixedSize的文档显示为:

如果ArrayList具有固定大小,则为true;否则为false.否则,错误.默认值为false.

没有微软推荐的标签似乎适用于这种情况.最佳拟合似乎是<c>,但是在Doxygen呈现文档时会<c>true</c>出现.true

然而,<b>true</b>与Doxygen一起使用产生了大胆的文字,因为我猜测它可能会.但这让我想知道将标准HTML标签与其他文档生成工具(如SandcastleGhostDoc)一起使用的可移植性.

c# styles literals xml-documentation

32
推荐指数
2
解决办法
8081
查看次数

C#/ .NET中方法的自动文档异常

我想要一些工具,最好是一个插入VS 2008/2010的工具,它将通过我的方法并添加关于它们可能抛出的异常的XML注释.我不希望<summary>为我生成或其他XML标记,因为我将自己填写,但如果即使在private/ protected方法我可以看到可以抛出哪些异常也会很好.否则,我发现自己经历了这些方法并将其悬停在其中的所有方法调用中以查看异常列表,然后更新该方法的<exception列表以包含这些.也许一个VS宏可以做到这一点?

由此:

private static string getConfigFilePath()
{
    return Path.Combine(Environment.CurrentDirectory, CONFIG_FILE);
}
Run Code Online (Sandbox Code Playgroud)

对此:

/// <exception cref="System.ArgumentException"/>
/// <exception cref="System.ArgumentNullException"/>
/// <exception cref="System.IO.IOException"/>
/// <exception cref="System.IO.DirectoryNotFoundException"/>
/// <exception cref="System.Security.SecurityException"/>
private static string getConfigFilePath()
{
    return Path.Combine(Environment.CurrentDirectory, CONFIG_FILE);
}
Run Code Online (Sandbox Code Playgroud)

更新: 看起来工具必须递归地遍历这些方法,例如,method1调用method2,它调用method3,记录为throw NullReferenceException,因此method2和method1都被工具记录为throw NullReferenceException.该工具还需要消除重复,如果方法中的两个调用被记录为抛出DirectoryNotFoundException,该方法将只列出<exception cref="System.IO.DirectoryNotFoundException"/>一次.

c# documentation exception xml-documentation

31
推荐指数
1
解决办法
3864
查看次数

在泛型类中注释构造函数的正确方法是什么?

评论这个的正确方法是什么?VS抱怨它:

/// <summary>
/// Initializes a new instance of the <see cref="Repository"/> class.
/// </summary>
/// <param name="unitOfWork">The unit of work.</param>
public Repository(IUnitOfWork unitOfWork)
{
    this.UnitOfWork = unitOfWork;
}
Run Code Online (Sandbox Code Playgroud)

警告11对"Data.Repository.Repository(Data.IUnitOfWork)"的XML注释具有无法解析的cref属性"Repository"C:\ Projects\xx\yy\DataAccess\Repository.cs 35 58数据

c# stylecop visual-studio-2010 xml-documentation visual-studio

29
推荐指数
2
解决办法
2万
查看次数

将常量渲染到XML文档中?

我有2个私有consts和一个公共方法:

private const byte _minAge = 24;
private const byte _maxAge = 29;

public bool IsInAgeRange() { ... }
Run Code Online (Sandbox Code Playgroud)

我正在添加XML文档,如果我的代码的用户可以在IntelliSense中读取它,我希望它是最好的: Checks whether the age is within the allowed range (between 24 and 29).

我的问题是:有没有办法将我的consts渲染到我的XML文档中?


我提出的替代方案是:

  1. 只需在文档中写入24和29(缺少对实际值的依赖)
  2. 使consts公开并添加<see cref="MinAge"><see cref="MaxAge">(减少封装并使文档信息量减少)

c# xml-documentation visual-studio

28
推荐指数
3
解决办法
3633
查看次数

将<returns> xml标签显示到visual studio intellisense中

我在我的<returns>一些方法中添加了xml标记,但是我无法在IntelliSense中看到它的内容.

这是我的代码:

/// <summary>
/// we all live in a yellow summary
/// </summary>
/// <returns>what it returns</returns>
public int MyMethod()
{ .... }
Run Code Online (Sandbox Code Playgroud)

有没有办法显示这些内容?

documentation intellisense xml-documentation visual-studio roslyn

27
推荐指数
2
解决办法
3499
查看次数

Delphi中的注释方法?

我有一段代码需要一些严肃的文档,并想询问是否有类似于C#/ .NET的In-code XML-Documentation的功能可用于Embarcadero Delphi.我的目的是以在Delphi XE3的自动完成中突出显示的方式显示有关如何正确使用特定方法的某些信息.

像这样(C#):

/// <summary>
/// Some useful information helping other developers use this method correctly
/// </summary>
public static void ADocumentedMethod();
Run Code Online (Sandbox Code Playgroud)

Delphi XE3是否支持这样的东西?

谢谢你的阅读.

delphi documentation xml-documentation

27
推荐指数
1
解决办法
4632
查看次数

如何记录XML文件的结构

在记录XML文件的结构时......

我的一位同事在Word表格中做到了这一点.

另一个将元素粘贴到Word文档中,其中包含以下注释:

<learningobject id="{Learning Object Id (same value as the loid tag)}" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:noNamespaceSchemaLocation="http://www.aicpcu.org/schemas/cms_lo.xsd">




<objectRoot>
    <v>
        <!-- Current version of the object from the repository. !-->
        <!-- (Occurance: 1) -->
    </v>
    <label>
        <!-- Name of the object from the repository. !-->
        <!-- (Occurance: 0 or 1 or Many) -->
    </label>
</objectRoot>
Run Code Online (Sandbox Code Playgroud)

哪种方法更受青睐?有没有更好的办法?

是否有其他选项不需要第三方Schema Documenter工具进行更新?

xsd xml-documentation

24
推荐指数
2
解决办法
3万
查看次数

如何在C#中的<seealso>标记中创建一个cref to方法重载?

我在MSDN链接中看到诸如"CompareOrdinal Overloads".如何在C#中编写这样的链接?

我试过了:

<seealso cref="MyMethod">MyMethod Overloads</seealso>
Run Code Online (Sandbox Code Playgroud)

但编译器给出了一个警告,即对于具有其他重载的方法是一个模糊的引用.

(初学者问题:我是否真的需要编写此标记来链接到重载,还是由文档处理器自动生成?)

c# xml-documentation

23
推荐指数
3
解决办法
7391
查看次数

记录F#代码

在具有单个构造函数的C#类中,我可以添加类摘要XML文档和构造函数XML文档:

///<summary>
///This class will solve all your problems
///</summary>
public class Awesome
{
    /// <summary>
    /// Initializes a new instance of the <see cref="Awesome"/> class.
    /// </summary>
    /// <param name="sauce">The secret sauce.</param>       
    public Awesome(string sauce)
    {
        //...implementation elided for security purposes
    }
}
Run Code Online (Sandbox Code Playgroud)

如何使用等效的F#类进行相同的操作,以使生成的文档相同?

type Awesome(sauce: string) = 
    //...implementation elided for security purposes
Run Code Online (Sandbox Code Playgroud)

澄清:我知道标准的XML文档标签可以在F#中使用.我的问题是如何将它们添加到上面的代码片段,以便记录类型和构造函数.

f# xml-documentation

23
推荐指数
3
解决办法
2469
查看次数

C#,XmlDoc:如何引用方法重载

如果我有这两种方法

public Foo Get(string bar) { ... }
public Foo Get(int bar) { ... }
Run Code Online (Sandbox Code Playgroud)

并在不同的方法上编写这段xml文档

/// <summary>
/// Has a close relation to the <see cref="Get"/> methods.
/// </summary>
Run Code Online (Sandbox Code Playgroud)

我得到一个蓝色波浪形Get,说这是一个不明确的参考'得到'.这是真的,但我希望它引用两者.这样做的正确方法是什么?或者我应该只引用单个方法重载?

c# overloading xml-documentation

22
推荐指数
1
解决办法
2612
查看次数