When creating Examples in the Content File Editor, you can choose the Get example source code from a file option in the Example editor to use content from an existing source file. This technique avoids duplicating example content that already exists in a source file (e.g. an example), and ensures that your documentation is up-to-date with the source file.
If your existing source files are fully working examples, you may wish to only use a portion of the file for an example. You can do this using the Section Name field in the example editor together with adding section markup to your source files as outlined below.
If you are using content from source files, you may wish to only use a portion of the file; for example if the source file is part of a complete sample project and contains code that is outside the scope of a specific example.
To use just a portion of a source file, you can mark up regions of the file using specifically formatted marker text to identify the start and end of a region, as well as the region name. By default the start marker should be of the format '#region {Name}#' or '#Region "{Name}"' where {Name} is the name of the region. The end region marker should be '#endregion' or '#End Region'. The start and end region markers can appear anywhere on a line, typically a comment line, so they can be used in any source file regardless of the language.
Here are a few examples of region markup: