Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/visual-basic/language-reference/xmldoc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The Visual Basic compiler can process documentation comments in your code to an
- [\<seealso>](seealso.md) <sup>1</sup>
- [\<summary>](summary.md)
- [\<typeparam>](typeparam.md) <sup>1</sup>
- [\<typeparamref>](typeparamref.md)
- [\<value>](value.md)

(<sup>1</sup> The compiler verifies syntax.)
Expand Down
38 changes: 38 additions & 0 deletions docs/visual-basic/language-reference/xmldoc/typeparamref.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
description: "Learn more about: <typeparamref> (Visual Basic)"
title: "<typeparamref>"
ms.date: 09/10/2025
helpviewer_keywords:
- "typeparamref XML tag"
- "<typeparamref> XML tag"
ai-usage: ai-assisted
---
# \<typeparamref> (Visual Basic)

Formats a word as a type parameter.

## Syntax

```xml
<typeparamref name="name"/>
```

## Parameters

`name`: The name of the type parameter to refer to. Enclose the name in double quotation marks (" ").

## Remarks

The `<typeparamref>` tag gives you a way to indicate that a word is a type parameter. The XML file can be processed to format this type parameter in some distinct way, for example in italics.

Compile with [-doc](../../reference/command-line-compiler/doc.md) to process documentation comments to a file.

## Example

This example uses the `<typeparamref>` tag to refer to the `T` type parameter.

:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbcnXmlDocComments/VB/Class1.vb" id="snippet9":::

## See also

- [XML Comment Tags](index.md)
2 changes: 2 additions & 0 deletions docs/visual-basic/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,8 @@ items:
href: language-reference/xmldoc/summary.md
- name: <typeparam>
href: language-reference/xmldoc/typeparam.md
- name: <typeparamref>
href: language-reference/xmldoc/typeparamref.md
- name: <value>
href: language-reference/xmldoc/value.md
- name: XML Axis Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,20 @@ Public Class Test
' Code goes here.
End Sub
' </snippet7>

' <typeparamref>
' <snippet9>
''' <summary>
''' Compares two items of type <typeparamref name="T"/>.
''' </summary>
''' <typeparam name="T">The type of items to compare.</typeparam>
''' <param name="item1">The first item of type <typeparamref name="T"/>.</param>
''' <param name="item2">The second item of type <typeparamref name="T"/>.</param>
''' <returns>True if the items are equal, False otherwise.</returns>
Public Function CompareItems(Of T As IComparable)(ByVal item1 As T, ByVal item2 As T) As Boolean
Return item1.CompareTo(item2) = 0
End Function
' </snippet9>
End Class

' <code> 925e5342-be05-45f2-bf66-7398bbd6710e.xml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>VbVbcnXmlDocComments</RootNamespace>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

</Project>