在XML文档中对C#的注释中,有没有办法将两个或多个函数标记为彼此重载,以便它们自动引用?理想情况下,它们也会以某种方式分组在沙堡生成的文档中.
目的:通常,我想链接到这组功能,例如在效用函数列表中,只提一个重载,并使其他功能很容易从那里发现.
目前我正在添加链接,但这很乏味.
在xml代码注释中是否有文件引用的标记?该文件是一个sql脚本文件.只是想知道是否有比这样的更好的方式
///<summary>
///please have a look at c:\code\project1\sql\file1.sql
///</summary>
Run Code Online (Sandbox Code Playgroud) 码:
public interface IFoo
{
void Bar();
}
public class FooClass : IFoo
{
/// <summary> ... </summary>
/// <seealso cref="?"/> //How do you reference the IFoo.Bar() method
public void Bar() { }
/// <summary> ... </summary>
/// <seealso cref="?"/> //How do you reference the standard Bar() method
void IFoo.Bar() { }
}
Run Code Online (Sandbox Code Playgroud)
我的猜测是:
<seealso cref="IFoo.Bar()"/> //Explicitly implemented interface method
<seealso cref="Bar()"/> //Standard method
Run Code Online (Sandbox Code Playgroud)
但是,我不确定.ECMA指南没有帮助区分,所以我想我正在寻找保证我的猜测是正确的.
我理解,如果您///在类,字段,方法或属性之上,Visual Studio将开始为您创建XML样式的注释.
但是,我在哪里可以为我的命名空间和/或库添加XML注释...
例如:
我不确定这些页面是手动创建的,还是通过在适当的位置添加XML样式的注释自动创建的?
我想要一个命令来自动换行.NET中的XML样式注释.
例:
/// <summary>
/// This comment line should be
/// on one line, and other lines in this <summary> block should be wordwrapped.
/// </summary>
Run Code Online (Sandbox Code Playgroud)
我不介意购买一些商业Visual Studio插件,如果他们能够做到这一点.
我有这样的通用异常类:
public class DuplicateException<TEntity> : Exception
{
public TEntity Entity { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我有非泛型方法可能会抛出构造的泛型异常:
void Save()
{
throw new DuplicateException<SomeEntity>();
}
Run Code Online (Sandbox Code Playgroud)
这个方法可能抛出这个通用异常,但只抛出这个构造类型DuplicateException<SomeEntity>,它不能抛出这个异常而不是其他类型参数SomeEntity.
现在我想在xml-comment中为Save方法指定这个事实.本文稍微介绍了如何使用泛型异常来评论方法,我尝试了以下两种方法:
1)通过VS中的自动完成默认插入:
/// <exception cref="DuplicateException{TEntity}" />
Run Code Online (Sandbox Code Playgroud)
2)替换TEntity为SomeEntity
/// <exception cref="DuplicateException{SomeEntity}" />
Run Code Online (Sandbox Code Playgroud)
但是在这两种情况下,输出XML仍然声明这个方法可能抛出一般的非构造类型,完全没有提到SomeEntity:
<exception cref="T:MyNameSpace.DuplicateException`1" />
Run Code Online (Sandbox Code Playgroud) 在Visual Studio 2010中,如果该方法没有自己的任何XML注释,有一种方法可以在接口上获取Intellisense吗?
我想这样的事情会非常有用.我喜欢在界面中包含XML注释,并且不喜欢在每个实现方法中重复(复制)相同的文本.只有在需要描述特定于实现方法的内容时,我才给该方法提供自己的XML注释.
我试图从doxygen和IntelliSense中获得最大收益,并发现XML命令在这里是一个不错的选择:一方面生成文档,另一方面在完成时显示文档。
吸引人的地方之一是成员之后的内联文档。
该doxygen的说明书只提到一个拥有成员后的文档的方式:///<。不幸的是,它与Visual Studio冲突,如下所示:
enum
{
A, ///< Doxygen understands this, but IntelliSense is oblivious to it.
B, /// <summary>IntelliSense understands this, but Doxygen applies it to the wrong member.</summary>
C, ///< <summary>Doxygen understand this, but IntelliSense considers it to be invalid XML.</summary>
};
Run Code Online (Sandbox Code Playgroud)
有没有一种方法可以以Doxygen和Visual Studio都正确理解的方式在XML成员之后编写文档,还是我应该退一步评论前一行?
我喜欢干净,"0警告" - C#中的项目.这包括我的项目对每个公共财产和类都有XML注释.
现在我使用实体框架进行迁移(代码优先).通过使用"添加迁移"创建迁移,这会导致在"迁移"文件夹中生成自动代码(标准行为).我可能希望/需要稍微修改这些类,但不想为在那里创建的公共类添加注释.
我知道我可以使用禁用警告#pragma disable但又不想为每个Migration-class执行此操作.
那么:是否有可能#pragma disable在完整的文件夹或命名空间上使用(或类似的东西)?
我不想使用像GhostDoc这样的解决方法.
这T:部分在使用cref属性时意味着什么?
<see cref="T:System.Windows.Form.Control"/>
Run Code Online (Sandbox Code Playgroud)
和
<see cref="System.Windows.Form.Control"/>
Run Code Online (Sandbox Code Playgroud) xml-comments ×10
c# ×8
.net ×3
sandcastle ×2
assemblies ×1
comments ×1
doxygen ×1
generics ×1
intellisense ×1
namespaces ×1
overloading ×1
pragma ×1
word-wrap ×1