正如名称所述,我不知道如何引用字典索引器.这里有什么帮助?:)
仅供参考,我尝试过:
<see cref="Item"/>
<see cref="Item(Int32)"/> //Highly doubted this would work.
<see cref="Item(TKey)"/>
<see cref="Item[TKey]"/>
Run Code Online (Sandbox Code Playgroud) 在我的C#XML Comment的<return>评论中,我希望输出(我使用Sandcastle)指定返回的Type,但我无法找到如何做到这一点.
Psuedo示例:
///<summary>
///Serves as a hash function for a particular type.
///</summary>
///<returns **Type="System.Int32"**>
///A hash code for the current Object.
///</returns>
public virtual int GetHashCode(){...}
Run Code Online (Sandbox Code Playgroud)
上面的例子模拟了我的猜测,告诉Sandcastle如何指定文档Syntax部分中记录的返回类型- 不是这样.
为清楚起见,这里是MSDN的GetHastCode()方法文档的屏幕截图,该文档显示了我正在拍摄的返回类型.
我们是否必须手动指定Type,或者我们是否可以指定Type(类似于mock示例)并让Sandcastle确定如何显示/格式化输出 - 类似于Sandcastle如何通过<param>标记自动显示/格式化参数的Type .

我想在一个单元格添加评论,所以..我做了:
...
ExcelPackage package = new ExcelPackage(new MemoryStream());
var ws = package.WorkBook.WorkSheet[1];
ws.Cells[1, 1].AddComment("Lot Price: $12,000", "");
...
package.SaveAs(new FileInfo("fileout.xlsx"));
package.Dispose();
Run Code Online (Sandbox Code Playgroud)
当尝试打开结果“fileout.xlsx”时,它显示一个对话框,说要尽可能多地恢复......然后恢复的fileout.xlsx显示错误:
“删除部分:/xl/comments1.xml 部分有 XML 错误。(评论)加载错误。第 5 行,第 0 列。删除部分:/xl/comments5.xml 部分有 XML 错误。(评论)加载错误。第 5 行,第 24 栏。”
当有注释时,EPPlus 似乎生成了错误的格式 xml。我想分享我对这个问题的解决方案:
我刚刚为评论添加了一个非空白标题行,例如此处的“REF”:
ws.Cells[1, 1].AddComment("Lot Price: $12,000", "REF");
Run Code Online (Sandbox Code Playgroud)
我希望有人可以对此有所帮助。
我想知道是否有一个插件,插件或任何其他简单的方法来摆脱c#的膨胀的xml评论?
公司需要文档,但在我的日常工作中,评论只是污染代码.有一种简单的方法可以简单地将所有xml文档在方法之前折叠到一行甚至更好地解决任何问题:-)
任何想法?
TIA
我尝试使用以下代码加载XML文件:
XmlSerializer xmlSerializer = new XmlSerializer(typeof(MyObject));
StreamReader reader = new StreamReader(fileName);
object myobject = xmlSerializer.Deserialize(reader);
Run Code Online (Sandbox Code Playgroud)
当文件包含这样的评论时:
<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XMLSpy v2007 sp2 -->
<route>
<!--File created on 26-Nov-2010 12:36:42-->
<file_content>1
<!--0 = type1 ; 1 = type2-->
</file_content>
</route>
Run Code Online (Sandbox Code Playgroud)
XmlSerializer返回一个错误,如
意外的节点类型注释.只能在具有简单或空内容的元素上调用ReadElementString方法
当我在文件中删除此注释时,它工作正常.
我不知道问题出在哪里,有什么想法吗?
基本上,在MSDN在线帮助中我经常遇到一个"注意"部分,但不能为我的生活弄清楚如何获得相同的输出.显然没有<note>标签.有谁知道如何使这个工作?
IDictionary(TKey,TValue) - 在这个例子中,如果你转到备注部分,你会看到我在说什么.
我正在使用Sandcastle帮助文件生成器.
我有一个带有XML注释的C#代码库,并且(由于这个站点)发现Doxygen可以很容易地生成转换代码和注释到HTML和PDF文档中所以我知道如何记录类和其他类型及其内容.
但是如何记录项目/程序集/命名空间?我的代码库有50多个; 他们的责任必须记录在案.
我也希望只对它们使用XML注释.但微软的XML评论手册并没有给我一个如何做到这一点的线索,我也找不到Doxygen文档中的任何线索.
我错过了什么?您如何为C#项目/程序集提供文档?
更新:我现在知道如何使用SHFB.
我想在类级别(在这种情况下实际上是a Module)提供更高级别的详细信息,包括代码示例等,但是我无法使用各种标签.
''' <summary>
''' Here's a summary of <c>SmallCodeChunk</c>
''' </summary>
''' <example>
''' Mmm, Skynet?
''' <code>
''' code.CodingItself("that's so meta!")
''' </code>
''' </example>
''' <remarks>
''' <para>Unit testable by replacing the <see cref="Implementation"/> property
''' with a mocked/stubbed <see cref="IThingy"/>.
''' </para>
''' <para>Paragraph of a bunch of stuff. <c>Y</c> is used for <c>True</c> just
''' for the sake of making the universe a (not) better place.
''' </para>
''' </remarks>
Run Code Online (Sandbox Code Playgroud)
我意识到使用的某些标签(例如<exception>)可能并不真正有效,但似乎我应该可以做类似的事情<example> …
我有一个通用的抽象基类,它有一些方法.这些方法对它们有XML注释:
/// <summary>
/// Controller for working with instances of {TModel}
/// </summary>
public abstract class BaseController<TModel> : ApiController
{
/// <summary>
/// Creates a {TModel}.
/// </summary>
[HttpPost]
public Task<TModel> Post([FromBody] TModel model)
{
...
return ...
}
}
Run Code Online (Sandbox Code Playgroud)
我希望能够这样实现它:
/// <summary>
/// Controller for working with instances of PersonModel
/// </summary>
public class PersonController : BaseController<PersonModel>
{
}
Run Code Online (Sandbox Code Playgroud)
并为PersonController生成XML注释,模仿基类上的注释.这将允许像https://github.com/domaindrivendev/Swashbuckle这样的东西来获取我的XML注释并很好地为PersonController显示它们.
目前评论如下:
<?xml version="1.0"?>
<doc>
<assembly>
<name>MyLibrary</name>
</assembly>
<members>
<member name="T:MyLibrary.PersonController">
<summary>
Controller for working with instances of …Run Code Online (Sandbox Code Playgroud) 我使用ASP.NET Core创建了一个Web API,并用招摇来创建文档。我在API端点上使用XML注释,以在文档中提供其他信息。昂首阔步的配置是:
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
// Set the comments path for the Swagger JSON and UI.
var basePath = AppContext.BaseDirectory;
var xmlPath = Path.Combine(basePath, "MyAPI.xml");
c.IncludeXmlComments(xmlPath);
});
Run Code Online (Sandbox Code Playgroud)
我的API端点之一及其XML注释是:
/// <summary>
/// Find an existing appointment using the visitor information: First name, last name, email, phone.
/// </summary>
/// <url>http://apiurl/api/appointments/appointmentsByVisitor</url>
/// <param name="criteria">consists of one or more of: Firstname, lastname, email, phone</param>
/// <returns>Existing appointment data in an …Run Code Online (Sandbox Code Playgroud) xml-comments ×10
c# ×6
sandcastle ×2
.net ×1
.net-4.0 ×1
asp.net-core ×1
collapse ×1
dictionary ×1
doxygen ×1
epplus ×1
excel ×1
indexer ×1
load ×1
msdn ×1
swagger ×1
vb.net ×1