我有一个超过500个Missing XML Comment警告的项目.我知道我可以删除XML注释功能,或者在任何地方粘贴空注释片段,但我更喜欢通用的解决方案,我可以进行一次更改,禁用此类型的所有警告.
我现在所做的就是投入
///<Summary>
///
///</Summary>
Run Code Online (Sandbox Code Playgroud)
要么
#pragma warning disable 1591
Run Code Online (Sandbox Code Playgroud)
如果可能的话,只是好奇.
这是一个不容错过的验证.
XML中是否存在行注释?所以,没有更接近的,就像编译器使用的"//".
我看到如何在XML中注释掉一个标签块?和其他几个讨论.
这种类型的评论可以用来评论一条线而不会在某处向某处打扰.
是否可以在XML标记内注释一个或多个属性?/* */来自C的东西
我尝试过使用<!-- -->,但没有成功.
<element
attribute1="value1"
attribute2="value2"
<!-- attribute3="value3" (commented value) -->
>
Run Code Online (Sandbox Code Playgroud) 我目前是一名编程学生,显然我的问题很简单,但我无法在网上找到答案.所以这里是:
在XML /// C#中的注释中,<returns>标签出现在哪里,我知道<summary>当你将鼠标悬停在方法调用上而不是返回标记时,标记中包含的所有内容都会显示在intellisense中.
那么<returns>标签在哪里?
谢谢.
在MonoDevelop中,当我输入"///"时,它会自动生成一个xml风格的注释,如下所示:
/// <summary>
/// Describes the variable x
/// </summary>
int x = 0;
Run Code Online (Sandbox Code Playgroud)
有没有办法在Visual Studio代码中获得此行为?
我已经在.NET Framework BCL中的类的许多XML注释中看到了这一点,但是从来没有找到解释它的功能的文档.
例如,查看System.Object会显示以下注释:
namespace System
{
/// <summary>Supports all classes in the .NET Framework class hierarchy
/// and provides low-level services to derived classes. This is the
/// ultimate base class of all classes in the .NET Framework; it is the
/// root of the type hierarchy.</summary>
/// <filterpriority>1</filterpriority>
[System.Runtime.InteropServices.ClassInterfaceAttribute(2)]
public class Object
{
/// <summary>Determines whether the specified
/// <see cref="T:System.Object" />
/// instances are considered equal.</summary>
/// <returns>true if objA is the same instance as objB or …Run Code Online (Sandbox Code Playgroud) 我写了一个小实用程序,允许我为另一个应用程序的App.config文件更改一个简单的AppSetting,然后保存更改:
//save a backup copy first.
var cfg = ConfigurationManager.OpenExeConfiguration(pathToExeFile);
cfg.SaveAs(cfg.FilePath + "." + DateTime.Now.ToFileTime() + ".bak");
//reopen the original config again and update it.
cfg = ConfigurationManager.OpenExeConfiguration(pathToExeFile);
var setting = cfg.AppSettings.Settings[keyName];
setting.Value = newValue;
//save the changed configuration.
cfg.Save(ConfigurationSaveMode.Full);
Run Code Online (Sandbox Code Playgroud)
这种效果很好,除了一个副作用.新保存的.config文件丢失所有原始XML注释,但仅在AppSettings区域内.是否可以从原始配置文件AppSettings区域保留XML注释?
c# xml configurationmanager configuration-files xml-comments
根据这篇文章,可以获得多行XML注释 - 而不是使用///,使用/** */.这是我对多行注释的解释,以及我想要发生的事情:
/**
* <summary>
* this comment is on line 1 in the tooltip
* this comment is on line 2 in the tooltip
* </summary>
*/
Run Code Online (Sandbox Code Playgroud)
但是,当我使用这个表单时,当我将鼠标悬停在我的代码中时弹出的工具提示是单行的,即它看起来就像我写了这样的评论:
/// <summary>
/// this comment is on line 1 in the tooltip
/// this comment is on line 2 in the tooltip
/// </summary>
Run Code Online (Sandbox Code Playgroud)
这种行为实际上是否仍然可以在VS2008中使用?
编辑
gabe指出我误解了"多线"意味着什么,我实际上需要使用<para>或<br>获得我想要的效果.我继续使用,<br>因为我想控制断线发生的位置,即
/// <summary>
/// this comment is on line 1 in …Run Code Online (Sandbox Code Playgroud) 基本上,何时真正需要(如果有的话)使用完全限定的xml参见参考:
<see cref="T:MyNamespace.Sub.MyType"/> //Option 1
<see cref="T:MyType"> //Option 2
Run Code Online (Sandbox Code Playgroud)
另外,引用.NET Framework对象怎么样?
<see cref="T:System.Collections.Generic.ICollection{T}"/> //Option 1
<see cref="T:ICollection{T}"/> //Option 2
Run Code Online (Sandbox Code Playgroud)
我知道完全符合条件的项目将始终允许Microsoft的Sandcastle正确地链接事物,但是一切都必须完全合格吗?
旁注:Microsoft Sandcastle是否能够链接到.NET Framework帮助文件,还是我通过引用浪费时间<see cref="T:System.Collections.Generic.ICollection{T}"/>?