Method TryConvert
TryConvert(ConvertBinder, out object?)
Provides implementation for type conversion operations. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations that convert an object from one type to another.
public override bool TryConvert(ConvertBinder binder, out object? result)
Parameters
binderConvertBinder- Provides information about the conversion operation. The
binder.Typeproperty provides the type to which the object must be converted. For example, for the statement(String)sampleObjectin C# (CType(sampleObject, Type)in Visual Basic), wheresampleObjectis an instance of the class derived from the DynamicObject class,binder.Typereturns the String type. Thebinder.Explicitproperty provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. resultobject- The result of the type conversion operation.