如何将文件夹级文档添加到 C# 程序集中?

发布于 2024-09-03 07:26:49 字数 300 浏览 4 评论 0原文

我:我是 .NET 平台的新手。

问题

在 Java 中,您可以通过创建 package-info.java 或 package.html 文件并将其存储在包文件夹中来向项目添加包级文档。如何使用 Visual Studio 2010 将等效文档添加到 C# 项目中?

背景

我喜欢在我正在处理的源代码项目的包/文件夹级别上下文中编写描述我动机的文档。我已经非常习惯使用各种语言(特别是 Java)的这种工作流程,并且我相信这是记录我的项目的好方法。

Me: I'm a relative new-comer to the .NET platform.

Problem

In Java, you can add package level documentation to your project by creating a package-info.java or package.html file and storing in the package folder. How do I add equivalent documentation to my project in C# using Visual Studio 2010?

Background

I like to write documentation describing my motivations in the package/folder level context of the source code projects that I am working on. I have become very accustomed to this workflow in a variety of languages (specifically Java) and I believe that it is a good way to document my project.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

逆流 2024-09-10 07:26:49

C# 会自动将基于 XML 的三斜杠注释转换为智能感知文档。

///<summary>This method does something!</summary>
///<parameter name="p1">The first parameter</parameter>
///<return>true, if the method completed successfully</return>
public bool DoSomething(int p1){
  return p1 > 0;
}

当您将项目编译成类库并在另一个项目中引用它时,上面的内容将自动变成有用的工具提示。此外,C# 编译器可以选择生成一个 XML 文件,其中包含所有这些注释以及 DLL。该 XML 文件可以输入 Sandcastle (如前所述)并以 MSDN 样式添加到文档项目中API 参考。

Sandcastle 工具有自己的项目和文档结构,因此,如果您要添加除 XML 生成的 Intellisense 参考之外的任何内容,您将需要启动一个副项目。

C# will automatically turn the XML-based tripple-slash comments into intellisense documentation.

///<summary>This method does something!</summary>
///<parameter name="p1">The first parameter</parameter>
///<return>true, if the method completed successfully</return>
public bool DoSomething(int p1){
  return p1 > 0;
}

When you compile your project into a class library and reference it in another project, the above will automatically be turned into a useful tooltip. In addition, the C# compiler can optionally produce an XML file with all of these comments alongside your DLL. This XML file can be fed into Sandcastle (as mentioned previously) and added to a documentation project as MSDN-style API reference.

The Sandcastle tool has its own project and documentation structure, so you'll want to start up a side project if you're going to add anything more than the XML-generated Intellisense reference.

洒一地阳光 2024-09-10 07:26:49

.NET 的重点有点不同,它对生成 IntelliSense 信息有很好的支持。文档触手可及。我相信当你使用过VS一段时间的时候你已经熟悉它了,查阅“xml文档”。

离线文档曾经由 NDoc 覆盖,但支持它的人退出了他的项目。 Sandcastle 项目 填补了这个空缺。顺便说一句,这些天似乎也有点迟缓。

The focus is a bit different in .NET, it has very good support for generating IntelliSense info. Documentation at your finger tips. I'm sure you're familiar with it when you used VS for a while, look up "xml documentation".

Off-line docs used to be covered by NDoc but the guy that supported it quit his project. The Sandcastle project took up the slack. Seems to be a bit laggy too these days btw.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文