I had some errors using @example to include the example file in the documentation. This is the workaround I used.
Place examplefile.cs
in a folder/project specifically for example code.
Place that folder in the Doxygen EXCLUDE
list (Expert->Input->EXCLUDEin Doxygen GUI frontend) and in the EXAMPLE_PATH
(Expert->Input->EXAMPLE_PATH in Doxygen GUI frontend)
Place this code block somewhere in a documented file (I put it in the file the example is for.)
/** @example examplefile.cs
* A description of the example file, causes the example file to show up in
* Examples */
This causes the file to show up under Examples in the Doxygen menu, but not show up as a class/file in your project.
Then document your class/function:
/** @brief MyClass does something
* @details I have something more long winded to say about it. See example
* in examplefile.cs: @include examplefile.cs */
This causes the example file to print out in it's entirety in the documentation of MyClass.