> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# C# Documentation Comment

C# documentation comments are specially formatted comments containing XML elements, placed immediately preceding user-defined types (classes, interfaces, structs, records, delegates) or members (methods, properties, fields, events). The C# compiler parses these comments during compilation to extract the XML elements and generate a structured XML file representing the API surface.

## Syntax

Documentation comments are denoted by either triple forward slashes (`///`) for single-line constructs or a forward slash followed by two asterisks (`/** ... */`) for multi-line block constructs.

```csharp theme={"dark"}
/// <summary>
/// Single-line documentation comment syntax.
/// </summary>

/**
 * <summary>
 * Multi-line block documentation comment syntax.
 * </summary>
 */
```

## Core XML Elements

The compiler recognizes specific XML tags to categorize the metadata of the documented code element.

* `<summary>`: Provides a concise, high-level description of the type or member.
* `<remarks>`: Specifies supplementary, detailed information that expands upon the `<summary>`.
* `<param name="parameterName">`: Describes a specific method or delegate parameter. The `name` attribute must match the parameter signature exactly.
* `<typeparam name="parameterName">`: Describes a generic type parameter.
* `<returns>`: Describes the return value of a method.
* `<value>`: Describes the value represented by a property.
* `<exception cref="ExceptionType">`: Identifies an exception that the method or property can throw. The `cref` attribute creates a compiler-verified cross-reference to the exception type.
* `<see cref="member"/>`: Creates an inline hyperlink to another code element within the documentation text.
* `<seealso cref="member"/>`: Creates a cross-reference link, typically placed in a "See Also" section at the end of the documentation.
* `<example>`: Contains a code example demonstrating the element. Often used in conjunction with the `<code>` tag.

## Structural Example

The following code block demonstrates the application of documentation comments to a generic method, utilizing multiple XML elements to map the method's signature and behavior.

```csharp theme={"dark"}
/// <summary>
/// Parses a string representation of a value into its generic type equivalent.
/// </summary>
/// <typeparam name="T">The target type to parse the string into. Must implement <see cref="IParsable{T}"/>.</typeparam>
/// <param name="input">The string containing the data to parse.</param>
/// <returns>An instance of <typeparamref name="T"/> representing the parsed value.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="input"/> is null.</exception>
/// <exception cref="FormatException">Thrown when <paramref name="input"/> is not in the correct format.</exception>
public T ParseValue<T>(string input) where T : IParsable<T>
{
    if (input == null)
    {
        throw new ArgumentNullException(nameof(input));
    }
    
    return T.Parse(input, CultureInfo.InvariantCulture);
}
```

## Compiler Configuration

To instruct the C# compiler to extract these comments and emit the XML file, the `GenerateDocumentationFile` property must be enabled in the project's `.csproj` file.

```xml theme={"dark"}
<PropertyGroup>
  <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
```

When enabled, the compiler validates the XML syntax and verifies all `cref` (code reference) and `name` attributes against the actual code elements. If a referenced parameter or type does not exist, the compiler generates a warning (e.g., `CS1572` or `CS1574`).

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor C# Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
