How to: Custom Implicit/Explicit conversion in VB.NET 2003
Hai ....., I would like to define some custom Implicit conversion function within my VB class. How can i do that. I have seen samples in C# but not in VB. Can anyone please help me on this
VB 2003 does *not* support defining implicit or explicit conversion operators on a class. You can use the operators on a class defined in C# by calling the op_implicit & op_explicit shared routines that C# creates.
VB 2005 *does* support defining & using implicit & explicit conversion operators on a class.
How to: Custom Implicit/Explicit conversion in VB.NET 2003
twostepted
DirectCast
Ctype
Convert
Lord_Anubis
Jay provided you with this link as a resource:
http://msdn2.microsoft.com/library/yf7b9sy7(en-us,vs.80).aspx
Donna M. Singel
VB 2005 *does* support defining & using implicit & explicit conversion operators on a class.
For details see:
http://msdn2.microsoft.com/library/yf7b9sy7(en-us,vs.80).aspx
Jay
Kevin LZJ
Public
Shared Function ImplicitConverter(ByVal d As Char) As Byte Console.WriteLine("conversion occurred") Return Convert.ToByte(d) End Functionjcviera
You missed me
public static implicit operator byte(Digit d)
{
Console.WriteLine( "conversion occurred" );
return d.value;
}
Can you provide me the translated version in VB.NET. Yes i want this
Dave Waterworth
Hai Jay,
How can I do that A sample can be really helpful or a link to such a resource