1
1
' Visual Basic .NET Document
2
2
Option Strict On
3
3
4
- Module Example
4
+ Module ImplicitExample
5
5
Public Sub Main()
6
6
PerformDecimalConversions()
7
7
Console.WriteLine( "-----" )
@@ -49,7 +49,7 @@ Module Example
49
49
Private Sub PerformCustomConversions()
50
50
' <Snippet3>
51
51
Dim sbyteValue As SByte = - 120
52
- Dim value As ByteWithSign = sbyteValue
52
+ Dim value As ImplicitByteWithSign = sbyteValue
53
53
Console.WriteLine(value.ToString())
54
54
value = Byte .MaxValue
55
55
Console.WriteLine(value.ToString())
@@ -61,19 +61,19 @@ Module Example
61
61
End Module
62
62
63
63
' <Snippet2>
64
- Public Structure ByteWithSign
64
+ Public Structure ImplicitByteWithSign
65
65
Private signValue As SByte
66
66
Private value As Byte
67
67
68
- Public Overloads Shared Widening Operator CType (value As SByte) As ByteWithSign
69
- Dim newValue As ByteWithSign
68
+ Public Overloads Shared Widening Operator CType (value As SByte) As ImplicitByteWithSign
69
+ Dim newValue As ImplicitByteWithSign
70
70
newValue.signValue = CSByte(Math.Sign(value))
71
71
newValue.value = CByte (Math.Abs(value))
72
72
Return newValue
73
73
End Operator
74
74
75
- Public Overloads Shared Widening Operator CType (value As Byte ) As ByteWithSign
76
- Dim NewValue As ByteWithSign
75
+ Public Overloads Shared Widening Operator CType (value As Byte ) As ImplicitByteWithSign
76
+ Dim NewValue As ImplicitByteWithSign
77
77
newValue.signValue = 1
78
78
newValue.value = value
79
79
Return newValue
0 commit comments