Dim myField as Field = new Field()
myField.Value = 13
…
If CInt(myField) = 13 or myField = 13…
The initial problem is that a Field is not an int, so you’ll get an invalid cast, fair enough. So I implemented the implicit/explicit conversion operators available in C#.
Field myField = new Field();
myField.Value = 13
…
if ((int)myField==13)…
The above, written in C#, now works but the previous VB.NET still fails! The problem is that VB.NET simply doesn’t call op_Implicit/op_Explicit functions exposed by the C# code. Delving into the Visual Basic engine you can see that under the covers it use IConvertable to do all of its conversions. So if you want VB.NET to understand that House = 7 really means House.Number = 7 then you need to implement IConvertable in the C# component.
After implementing IConvertable the above code sprang into life.
Plz look the following link about implict and explicit conversions.
http://vb.net-informations.com/language/vb.net_implicit_explicit_conversion.htm
lev.