July 2015
Intermediate to advanced
1300 pages
87h 27m
English
Objects implementing the IConvertible interface expose a series of ToXXX methods exactly as the Convert class does so that such objects can easily be converted into another type. This example uses a structure instead of a class, for the sake of simplicity. Listing 13.4 shows how the IConvertible interface can be implemented.
LISTING 13.4 Implementing the IConvertible Interface
Public Structure ThreePoint Implements IConvertible Public Function GetTypeCode() As System.TypeCode Implements _ System.IConvertible.GetTypeCode Return TypeCode.Object End Function 'Just a custom return value Public Function ToBoolean(provider As System.IFormatProvider) _ As Boolean ...