BinaryTypeConverter Class

Provides a type converter to convert any Object to and from base64 encoded String or byte array representations.

Definition

Namespace: KGySoft.ComponentModel
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0-preview.1
C#
public class BinaryTypeConverter : TypeConverter
Inheritance
Object    TypeConverter    BinaryTypeConverter

Remarks

  Note

This converter uses the BinarySerializationFormatter class in safe mode internally. The ConvertFrom(ITypeDescriptorContext, CultureInfo, Object) method may throw a SerializationException if the serialization stream contains any type name to resolve other than the Type specified in the constructor. So it can be used for types only that do not use any types internally that are not supported natively by the BinarySerializationFormatter class.
See the Remarks section of the BinarySerializationFormatter class for the natively supported types.

Constructors

BinaryTypeConverter Initializes a new instance of the BinaryTypeConverter class.
BinaryTypeConverter(Type) Initializes a new instance of the BinaryTypeConverter class.

Properties

Type Gets the type of the member this BinaryTypeConverter instance is referring to.

Methods

CanConvertFrom Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context.
(Overrides TypeConverterCanConvertFrom(ITypeDescriptorContext, Type))
CanConvertTo Returns whether this converter can convert the object to the specified type, using the specified context.
(Overrides TypeConverterCanConvertTo(ITypeDescriptorContext, Type))
ConvertFrom Converts the given object to its original type.
(Overrides TypeConverterConvertFrom(ITypeDescriptorContext, CultureInfo, Object))
ConvertTo Converts the given value object to the specified type.
(Overrides TypeConverterConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type))

Extension Methods

Convert Converts an Object specified in the obj parameter to the desired targetType.
See the Examples section of the generic ConvertTTarget(Object, CultureInfo) overload for an example.
(Defined by ObjectExtensions)
ConvertTTarget Converts an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions)
In Gets whether item is among the elements of set.
See the Examples section of the generic InT(T, T) overload for an example.
(Defined by ObjectExtensions)
TryConvert Tries to convert an Object specified in the obj parameter to the desired targetType.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)
TryConvert Tries to convert an Object specified in the obj parameter to the desired targetType.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)
TryConvertTTarget Tries to convert an Object specified in the obj parameter to the desired TTarget.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)
TryConvertTTarget Tries to convert an Object specified in the obj parameter to the desired TTarget.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)

See Also