0

According to this documentation, I should add an unique ID string to each element. This ID string is composed of a code that represent the type of the object, followed by a string that is generally namespace.class.method

Problem is, if the namespace, class, or method names change, the doc has to be updated. In python, I use the name attribute to workaround this kind of problems, when a class is refactored, the doc is also refactored at the same time

Can I do something similar in C# and access the namespace, class name, or method name dynamically ?

I guess the answer is no since C# is a compiled language and the data is not available at this time, but still wondering. Documentation will be generated using Doxygen

Tim Jarosz
  • 1,133
  • 1
  • 8
  • 15
Milan
  • 1,547
  • 1
  • 24
  • 47
  • You are looking for `Reflection` in C#. You can use `System.Reflection.MethodBase.GetCurrentMethod().Name;` to get the method name. You can do a lot with reflection. Similar question: https://stackoverflow.com/questions/44153/can-you-use-reflection-to-find-the-name-of-the-currently-executing-method – Tim Jarosz Dec 21 '22 at 16:44
  • I can do it with reflection but will it produce a result once the doc is built using doxygen ? As the code will not be run, I am unsure it will – Milan Dec 21 '22 at 16:53
  • 1
    That is the first time you mention "doxygen". Update your question with the full context of what you are trying to do. – Tim Jarosz Dec 21 '22 at 16:56
  • 1
    In the mentioned microsoft documentation it is stated "The compiler observes the following rules when it generates the ID strings" so doxygen has no idea about these "ID strings". The rules are laid out in the documentation but not implemented in doxygen and I don't see in the C# documentation no tag (or something alike) that can be in the documentation and be replaced on documentation generation. So please explain. – albert Dec 21 '22 at 17:53

0 Answers0