2
votes

I am fairly new to doxygen, and I am trying to figure out how to do code snippets examples, as seen below:

http://www.doxygen.nl/manual/examples/example/html/example_test_8cpp-example.html

If I am not mistaken, this is how the documentation explains how to do such things:

http://www.doxygen.nl/manual/commands.html#cmdexample

Which does not work 100%, at least for me. I have found examples of how to do this with other languages, but not c#.

What I get is the examples tab, the page showing the files im using as examples, and I can even click on the link that "\example SomeFile.cs" provides. Except there is no code on the page, just the extra detail i provided.

Does anyone have any experience with having doxygen be able to generate the pages (like in the first link) with C#?

2

2 Answers

2
votes

I know this is a bit old but this question showed up on the top of the search when looking and didn't have an answer. Thought this might help someone else.

You can use the @code and @endcode tags in your comments to produce code snippets in doxygen:

Like so:

/// <summary>
/// This does something cool.
/// </summary>
/// <example>
/// Usage:
/// @code
///     var = GetValueOf(9f);
/// @endcode
/// </example>
/// <param name="_myParam">A float value to return</param>
public float GetValueOf(float _myParam)
{
   return _myParam;
}
1
votes

Incase if anyone wants to do this in the future and cant seem to find out how to do it.

Use Doxygen GUI. Go to Expert tab. Select Input under topics. Scoll down to EXAMPLE_PATH. Find the files that contain your example. I tend to seperate my test in seperate files so this works for me.