What does indentation in a type name in the Visual Studio debugger mean?

When you Debug.Print some types of objects in the Visual Studio 2010 debugger, there is a flip side to the output. What does the flip side mean?

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

Output in the Immediate Window debugger:

  System.Collections.Generic.List`1 [System.String] 
+6
source share
2 answers

It indicates the dimension of the type type (in this case, the string) - for example, List (Of String), the string is the first element (1-indexed).

Try creating SomeClass(Of T as String, U as Integer) and see 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 
+3
source

This part of the string representation of generics in the common language runtime.

The number after the return stroke (`) indicates the number of arguments of the general type that the type takes. Types in square brackets then indicate how these common type arguments were related.

+3
source

Source: https://habr.com/ru/post/904262/


All Articles