Implicit conversions should only be defined if the type can be converted to or from (preferably to another) and should not lose data. Another criterion is that implicit conversions should be fairly inexpensive, because the developer using your class will probably not know when implicit conversions occur.
One example: conversion between coordinate systems. For example, a polar coordinate vector can be convenient, which can convert to Cartesian coordinates. However, because of floating point rounding, it would still be better to leave this as an explicit conversion, so that the programmer needs to cast to force the conversion.
Implicit conversion can be justified if you have two types of data that store data in one format, but the only difference between the types is semantic - how they are used or what they mean. Real-world example: conversion between datetime data types that have the same (or compatible) representation but differ only in the start date of epoc. You will find them when porting old code bases to newer structures, where both define the datetime type, but the semantics are slightly different. Implicit conversion here (assuming there is no data loss at all) is probably a good and good idea.
If you have a set of types, and you have defined your own rules for how types can be converted among themselves, then some of these conversions may be implicit and some explicit depending on the "seriousness" of the conversion. The main instance where I used implicit conversion when implementing the class in .NET was when I implemented the Win32 Variant semantics for the Delphi runtime library. Win32 and the Delphi language determine the number of conversions from Variant data, which can be done implicitly.
The fact that you did not find the need to create implicit transformations is actually good. Just because you can doesnβt mean what you need. Implicit conversions exist in .NET primarily to allow different programming languages ββto present their own semantics so that they are interoperable and understandable for other .NET languages.
dthorpe
source share