Share via


<example> (C# Programming Guide)

<example>description</example>

Parameters

  • description
    A description of the code sample.

Remarks

The <example> tag lets you specify an example of how to use a method or other library member. This commonly involves using the <code> tag.

Compile with /doc to process documentation comments to a file.

Example

// compile with: /doc:DocFileName.xml  

/// text for class TestClass 
public class TestClass
{
    /// <summary> 
    /// The GetZero method. 
    /// </summary> 
    /// <example> This sample shows how to call the <see cref="TestClass.GetZero"/> method.
    /// <code> 
    /// class TestClass  
    /// { 
    ///     static int Main()  
    ///     { 
    ///         return GetZero(); 
    ///     } 
    /// } 
    /// </code> 
    /// </example> 
    public static int GetZero()
    {
        return 0;
    }

    /// text for Main 
    static void Main()
    {
    }
}

See Also

Concepts

C# Programming Guide

Reference

Recommended Tags for Documentation Comments (C# Programming Guide)