在Visual Studio调试器中,类型名称中的反引号是什么意思? [英] What does a backtick in a type name mean in the Visual Studio debugger?

查看:225
本文介绍了在Visual Studio调试器中,类型名称中的反引号是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Visual Studio 2010调试器中的 Debug.Print 某些对象类型时,输出包括反引号。

  Dim myList as List = a List 
Debug.Print(myList.GetType() .ToString()

即时窗口调试器中的输出

 System.Collections.Generic.List`1 [System.String] 

解决方案

通用类型的维数(在这种情况下,字符串) - 例如List(Of String),该字符串是第一个元素(1索引)。



试试创建一个 SomeClass(T作为字符串,U作为整数)并且看到你得到了什么。

 公共类TestGeneric(Of T,U)
Public Sub TellType(ByVal Something As T,ByVal SomethingElse As U)
Console.WriteLine(Me.GetType())
Console.WriteLine(Something.GetType())
Console.WriteLine(SomethingElse.GetType())
End Sub
End Class

Sub Main()
Dim MyTestGeneric As New TestGeneric(Of String,Integer)
MyTestGeneric.TellType(Test,3)
Console.ReadKey(True)
End Sub


When you Debug.Print some object types in the Visual Studio 2010 debugger, the output includes a backtick. What does the backtick mean?

Dim myList as List = a List
Debug.Print(myList.GetType().ToString()

Output in Immediate Window debugger:

System.Collections.Generic.List`1[System.String]

解决方案

It's indicating the dimension of the generic type (in this case, string) - eg a List(Of String), the string is the first element (1-indexed).

Try creating an SomeClass(Of T as String, U as Integer) and seeing what you get.

Public Class TestGeneric(Of T, U)
    Public Sub TellType(ByVal Something As T, ByVal SomethingElse As U)
        Console.WriteLine(Me.GetType())
        Console.WriteLine(Something.GetType())
        Console.WriteLine(SomethingElse.GetType())
    End Sub
End Class

Sub Main()
    Dim MyTestGeneric As New TestGeneric(Of String, Integer)
    MyTestGeneric.TellType("Test", 3)
    Console.ReadKey(True)
End Sub

这篇关于在Visual Studio调试器中,类型名称中的反引号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆