2

I'm currently developing a small C# .dll library module for one of my company's product. It's my first time developing non-UWP app in C# and I'm kind of lost how to effectively distribute an interface for my library.

In C++/C, header files are distributed along with the .dll library and headers functions as interfaces that the users interact with the software. Documentations may be provided separately or often documentation is included in the header file.

In C#, what I'm seeing most often is that people would declare public on exposed classes or methods(rest declared as internal or private) and distribute the .dll with a sample project. Whilst a sample project is usually enough, when user want to use lesser known feature he or she has to dig through the namespace or generated "header file" from meta data which doesn't have any documentation.

I want to know what an experienced C# developer would do in such situation.

legokangpalla
  • 495
  • 5
  • 20
  • Your concerns are not clear... Maybe you are looking for [XML Documentation Tutorial(C#)](https://msdn.microsoft.com/en-us/library/aa288481(v=vs.71).aspx)? – Alexei Levenkov Oct 26 '16 at 02:26
  • @AlexeiLevenkov I'm looking for a C# equivalent for C .h file for distributing with the .dll file. Although, if there is none, I guess providing a separate documentation is one way to do it. – legokangpalla Oct 26 '16 at 02:39
  • http://stackoverflow.com/questions/11814771/why-doesnt-c-sharp-have-header-files-will-the-namespace-take-care-of-everythin ? Note that it is way harder to misrepresent you types in .Net than in C header file (where you can hide a lot of things...) Clarifying why you believe assembly by itself provides less information than .h file may help... Presumably you don't consider .Net framework a good example - searching for project that achieves what you are looking for is another option. – Alexei Levenkov Oct 26 '16 at 02:48
  • In C#, the DLL is not just the executable code but *also* the header file. A .NET assembly contains *metadata*, a description of the public types in the assembly. Nothing special needs to be done, the consumer of your library simply adds a reference to your assembly. The equivalent of #include. The compiler knows how to read the metadata from the DLL. – Hans Passant Oct 26 '16 at 06:20

1 Answers1

1

There is no equivalent: as C# doesn't have any header files, there's really nothing to reference.

You'll wanna look into XML documentation, as suggested by a commenter - that will (with Visual Studio) give in-IDE tooltips suggesting implementation details and allowing you to convey similar, if not richer information.

iikorni
  • 507
  • 5
  • 16