Skip to content

Commit 975521f

Browse files
CopilotBillWagnergewarren
authored
Add missing typeparamref XML documentation tag for Visual Basic (#48298)
* Initial plan * Add missing typeparamref XML documentation tag for Visual Basic Co-authored-by: BillWagner <[email protected]> * Apply suggestions from code review * Add typeparamref to TOC and create VB project file for CI Co-authored-by: BillWagner <[email protected]> * Apply suggestions from code review * Apply suggestions from code review * Apply suggestions from code review * Update samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbcnXmlDocComments/VB/VbVbcnXmlDocComments.vbproj * Update docs/visual-basic/language-reference/xmldoc/typeparamref.md Co-authored-by: Genevieve Warren <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: BillWagner <[email protected]> Co-authored-by: Bill Wagner <[email protected]> Co-authored-by: Genevieve Warren <[email protected]>
1 parent 3405fbe commit 975521f

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed

docs/visual-basic/language-reference/xmldoc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ The Visual Basic compiler can process documentation comments in your code to an
3737
- [\<seealso>](seealso.md) <sup>1</sup>
3838
- [\<summary>](summary.md)
3939
- [\<typeparam>](typeparam.md) <sup>1</sup>
40+
- [\<typeparamref>](typeparamref.md)
4041
- [\<value>](value.md)
4142

4243
(<sup>1</sup> The compiler verifies syntax.)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
description: "Learn more about: <typeparamref> (Visual Basic)"
3+
title: "<typeparamref>"
4+
ms.date: 09/10/2025
5+
helpviewer_keywords:
6+
- "typeparamref XML tag"
7+
- "<typeparamref> XML tag"
8+
ai-usage: ai-assisted
9+
---
10+
# \<typeparamref> (Visual Basic)
11+
12+
Formats a word as a type parameter.
13+
14+
## Syntax
15+
16+
```xml
17+
<typeparamref name="name"/>
18+
```
19+
20+
## Parameters
21+
22+
`name`: The name of the type parameter to refer to. Enclose the name in double quotation marks (" ").
23+
24+
## Remarks
25+
26+
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.
27+
28+
Compile with [-doc](../../reference/command-line-compiler/doc.md) to process documentation comments to a file.
29+
30+
## Example
31+
32+
This example uses the `<typeparamref>` tag to refer to the `T` type parameter.
33+
34+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbcnXmlDocComments/VB/Class1.vb" id="snippet9":::
35+
36+
## See also
37+
38+
- [XML Comment Tags](index.md)

docs/visual-basic/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,8 @@ items:
852852
href: language-reference/xmldoc/summary.md
853853
- name: <typeparam>
854854
href: language-reference/xmldoc/typeparam.md
855+
- name: <typeparamref>
856+
href: language-reference/xmldoc/typeparamref.md
855857
- name: <value>
856858
href: language-reference/xmldoc/value.md
857859
- name: XML Axis Properties

samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbcnXmlDocComments/VB/Class1.vb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,20 @@ Public Class Test
168168
' Code goes here.
169169
End Sub
170170
' </snippet7>
171+
172+
' <typeparamref>
173+
' <snippet9>
174+
''' <summary>
175+
''' Compares two items of type <typeparamref name="T"/>.
176+
''' </summary>
177+
''' <typeparam name="T">The type of items to compare.</typeparam>
178+
''' <param name="item1">The first item of type <typeparamref name="T"/>.</param>
179+
''' <param name="item2">The second item of type <typeparamref name="T"/>.</param>
180+
''' <returns>True if the items are equal, False otherwise.</returns>
181+
Public Function CompareItems(Of T As IComparable)(ByVal item1 As T, ByVal item2 As T) As Boolean
182+
Return item1.CompareTo(item2) = 0
183+
End Function
184+
' </snippet9>
171185
End Class
172186

173187
' <code> 925e5342-be05-45f2-bf66-7398bbd6710e.xml
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<RootNamespace>VbVbcnXmlDocComments</RootNamespace>
6+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
7+
</PropertyGroup>
8+
9+
</Project>

0 commit comments

Comments
 (0)