1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
Option Strict On
Imports System
Imports System.Collections
Imports System.Reflection
Class UserConversion1
Shared Function Main() As Integer
Dim wstr As New WString
Dim str As String
str = CStr(wstr)
str = CType(wstr, String)
str = wstr
Dim wb As New WByte
Dim b As Byte
b = CByte(wb)
b = CType(wb, Byte)
b = wb
Dim wsb As New WSByte
Dim sb As SByte
sb = CSByte(wsb)
sb = CType(wsb, SByte)
sb = wsb
Dim ws As New WShort
Dim s As Short
s = CShort(ws)
s = CType(ws, Short)
s = ws
Dim wus As New WUShort
Dim us As UShort
us = CUShort(wus)
us = CType(wus, UShort)
us = wus
Dim wi As New WInteger
Dim i As Integer
i = CInt(wi)
i = CType(wi, Integer)
i = wi
Dim wui As New WUInteger
Dim ui As UInteger
ui = CUInt(wui)
ui = CType(wui, UInteger)
ui = wui
Dim wl As New WLong
Dim l As Long
l = CLng(wl)
l = CType(wl, Long)
l = wl
Dim wul As New WULong
Dim ul As ULong
ul = CULng(wul)
ul = CType(wul, ULong)
ul = wul
Dim wf As New WSingle
Dim f As Single
f = CSng(wf)
f = CType(wf, Single)
f = wf
Dim wr As New WDouble
Dim r As Double
r = CDbl(wr)
r = CType(wr, Double)
r = wr
Dim wdec As New WDecimal
Dim dec As Decimal
dec = CDec(wdec)
dec = CType(wdec, Decimal)
dec = wdec
Dim wbool As New WBoolean
Dim bool As Boolean
bool = CBool(wbool)
bool = CType(wbool, Boolean)
bool = wbool
Dim wc As New WChar
Dim c As Char
c = CChar(wc)
c = CType(wc, Char)
c = wc
Dim wdt As New WDate
Dim dt As Date
dt = CDate(wdt)
dt = CType(wdt, Date)
dt = wdt
Return 0
End Function
Class WString
Shared Widening Operator CType(ByVal v As WString) As String
Return ""
End Operator
End Class
Class WByte
Shared Widening Operator CType(ByVal v As WByte) As Byte
Return 0
End Operator
End Class
Class WSByte
Shared Widening Operator CType(ByVal v As WSByte) As SByte
Return 0
End Operator
End Class
Class WShort
Shared Widening Operator CType(ByVal v As WShort) As Short
Return 0
End Operator
End Class
Class WUShort
Shared Widening Operator CType(ByVal v As WUShort) As UShort
Return 0
End Operator
End Class
Class WInteger
Shared Widening Operator CType(ByVal v As WInteger) As Integer
Return 0
End Operator
End Class
Class WUInteger
Shared Widening Operator CType(ByVal v As WUInteger) As UInteger
Return 0
End Operator
End Class
Class WLong
Shared Widening Operator CType(ByVal v As WLong) As Long
Return 0
End Operator
End Class
Class WULong
Shared Widening Operator CType(ByVal v As WULong) As ULong
Return 0
End Operator
End Class
Class WSingle
Shared Widening Operator CType(ByVal v As WSingle) As Single
Return 0
End Operator
End Class
Class WDouble
Shared Widening Operator CType(ByVal v As WDouble) As Double
Return 0
End Operator
End Class
Class WDecimal
Shared Widening Operator CType(ByVal v As WDecimal) As Decimal
Return 0
End Operator
End Class
Class WChar
Shared Widening Operator CType(ByVal v As WChar) As Char
Return "0"c
End Operator
End Class
Class WBoolean
Shared Widening Operator CType(ByVal v As WBoolean) As Boolean
Return False
End Operator
End Class
Class WDate
Shared Narrowing Operator CType(ByVal v As WDate) As Date
Return Date.MinValue
End Operator
End Class
End Class
|