I've been reading up on this and I'm not sure I'm seeing what C# can do that VB can't. In VB you can overload operators (+, -, >, <, etc.) including CType. So, in VB you could do:
Public Shared Widening Operator CType(m As Money) As Double
'-- do approrpiate conversion...
End Operator
Public Shared Widening Operator CType(i As Integer) As Money
'-- do approrpiate conversion...
End Operator
Public Shared Narrowing Operator CType(d As Double) As Money
'-- do approrpiate conversion...
End Operator
I just created a sample app and I don't think there is any difference between VB and C# related to this. Narrowing conversion can be implicit, but widening conversions must make the conversion explicitly:
'-- This works because money has a Narrowing CType() operator
' between integer and money
Dim m As Money = 34
'-- Likewise you could assigna money value to a double
Dim d As Double = m
'-- But if you wanted to do the reverse, you'd have to use
' an explicit conversion
Dim m2 As Money = CType(234.5334, Money)
C# can't do narrowing conversions implicitly, can it? Am I missing something?
Thanks for taking the time to respond to this also, as I'm learning a lot. This is yet another reason SF and this forum rocks!