VB.Net/Windows System/System Data Type
Версия от 16:40, 26 мая 2010; (обсуждение)
Get Variable Underlying System Type
Imports System.Reflection
Public Class MainClass
Public Shared Sub Main()
Dim A As Integer
Dim B As Double
Dim C As String = "Hello, world"
Dim D As DateTime = New DateTime(Now.Ticks)
Dim E As Byte
Dim F As Boolean
Console.WriteLine("Type Codes:")
Console.WriteLine("Integer: " & A.GetTypeCode() & _
" " & A.GetType().Name & " " & A.GetType().UnderlyingSystemType.ToString())
Console.WriteLine("Double: " & B.GetTypeCode() & _
" " & B.GetType().Name & " " & B.GetType().UnderlyingSystemType.ToString())
Console.WriteLine("String: " & C.GetTypeCode() & _
" " & C.GetType().Name & " " & C.GetType().UnderlyingSystemType.ToString())
Console.WriteLine("DateTime: " & D.GetTypeCode() & _
" " & D.GetType().Name & " " & D.GetType().UnderlyingSystemType.ToString())
Console.WriteLine("Byte: " & E.GetTypeCode() & _
" " & E.GetType().Name & " " & E.GetType().UnderlyingSystemType.ToString())
Console.WriteLine("Boolean: " & F.GetTypeCode() & _
" " & F.GetType().Name & " " & F.GetType().UnderlyingSystemType.ToString())
End Sub
End Class