I'm developing a project and want to provide some insight about specific namespace context (e.g. this is package with API implemented by plugin, this is package with API provided to plugins by application, and this is interlayer with objects passed between application and plugin). In java there is package-info.java
, is there any similar concept for C#?
Asked
Active
Viewed 319 times
1

Etki
- 2,042
- 2
- 17
- 40
-
Will adding a summary not work? You know, when you type 3 slashes in a row "///" – Terry Tyson Oct 11 '19 at 21:22
-
2One major difference between C# and Java is the relationship between language elements and packaging. You aren't annotating the _namespace_ with `package-info.java`, you are annotating the package (and, in Java, there's a one-to-one relationship (as far as I remember - it's been a while). In C#, a namespace can span assemblies (and, a class can span files). Take a look at the attributes in the AssemblyInfo.cs file (on traditional framework projects) and at the `///` XML comments that @TerryTyson is talking about. – Flydog57 Oct 11 '19 at 21:29
-
1@Flydog57 AssemblyInfo.cs looks like the thing. I'd add this as answer if i were you. – Etki Oct 11 '19 at 21:32
-
As you probably have noticed, you can't add `///` XML comments to a namespace. I was going to answer your question (as you suggested), but while doing research, I found https://stackoverflow.com/questions/23144872/assemblytitle-attribute-in-the-net-framework which answers it completely. – Flydog57 Oct 14 '19 at 20:27
1 Answers
0
///, followed by the summary tags are probably the best and most efficient way of adding comments to namespaces.
namespace Content101 {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
}
-
XML Comments go _**Above**_ the element they are attached to, not below. If you annotate a namespace directive with an `///` XML comment (by placing the comment above `namespace`, you will get a `CS1587: XML comment is not placed on a valid language element` – Flydog57 Oct 14 '19 at 20:34