views:

26

answers:

2

Hey,

is there a way to share xml-documentation of the parameters to all the overloads? Lets say I have 10 overloads of a method but they all share the first 5 parameter (I use C# so I cannot have optional parameters).

How do I do so that I do not have to write the same text for all of the parameters?

A: 

You can't. The task could be automated but the same text will have to be there for the compiler.

David
What do you mean by automated?
Oskar Kjellin
I mean that you could write a tool that could populate the XML documentation for your overrides. You would have to run that before you run the compiler.
David
+1  A: 

This doesn't really answer your question but I find that when I get more then 5-8 overloads it is simpler to provide a simple POCO with every possible argument.

This gives me a place to embed validation and add as many properties as I like at a later date. and its a single place to add xml docs

Thanks for a good answer! Might use this in some other case but in this case it is not possible(lots of parameters that I create an object after calling the method which would lead to having to create the object before calling the method each time(which can be many places). I have used this in other projects however and there it works fine to the solution is solid
Oskar Kjellin