PSTypeConverter PSTypeConverter PSTypeConverter Class

Definition

Defines a base class implemented when you need to customize the type conversion for a target class.

public abstract class PSTypeConverter
type PSTypeConverter = class
Public MustInherit Class PSTypeConverter
Inheritance
PSTypeConverterPSTypeConverterPSTypeConverter
Derived

Remarks

 There are two ways of associating the PSTypeConverter with its target class:
     - Through the type configuration file.
     - By applying a TypeConverterAttribute to the target class.

 Unlike System.ComponentModel.TypeConverter, PSTypeConverter can be applied to a family of types (like all types derived from System.Enum).
 PSTypeConverter has two main differences from TypeConverter:
     - It can be applied to a family of types and not only the one type as in TypeConverter. In order to do that
 ConvertFrom and CanConvertFrom receive destinationType to know to which type specifically we are converting sourceValue.
     - ConvertTo and ConvertFrom receive formatProvider and ignoreCase.
 Other differences to System.ComponentModel.TypeConverter:
     - There is no ITypeDescriptorContext.
     - This class is abstract

Constructors

PSTypeConverter() PSTypeConverter() PSTypeConverter()

Methods

CanConvertFrom(PSObject, Type) CanConvertFrom(PSObject, Type) CanConvertFrom(PSObject, Type)

Determines if the converter can convert the sourceValue parameter to the destinationType parameter.

CanConvertFrom(Object, Type) CanConvertFrom(Object, Type) CanConvertFrom(Object, Type)

Determines if the converter can convert the sourceValue parameter to the destinationType parameter.

CanConvertTo(PSObject, Type) CanConvertTo(PSObject, Type) CanConvertTo(PSObject, Type)

Returns true if the converter can convert the sourceValue parameter to the destinationType parameter

CanConvertTo(Object, Type) CanConvertTo(Object, Type) CanConvertTo(Object, Type)

Returns true if the converter can convert the sourceValue parameter to the destinationType parameter

ConvertFrom(PSObject, Type, IFormatProvider, Boolean) ConvertFrom(PSObject, Type, IFormatProvider, Boolean) ConvertFrom(PSObject, Type, IFormatProvider, Boolean)

Converts the sourceValue parameter to the destinationType parameter using formatProvider and ignoreCase

ConvertFrom(Object, Type, IFormatProvider, Boolean) ConvertFrom(Object, Type, IFormatProvider, Boolean) ConvertFrom(Object, Type, IFormatProvider, Boolean)

Converts the sourceValue parameter to the destinationType parameter using formatProvider and ignoreCase

ConvertTo(PSObject, Type, IFormatProvider, Boolean) ConvertTo(PSObject, Type, IFormatProvider, Boolean) ConvertTo(PSObject, Type, IFormatProvider, Boolean)

Converts the sourceValue parameter to the destinationType parameter using formatProvider and ignoreCase

ConvertTo(Object, Type, IFormatProvider, Boolean) ConvertTo(Object, Type, IFormatProvider, Boolean) ConvertTo(Object, Type, IFormatProvider, Boolean)

Converts the sourceValue parameter to the destinationType parameter using formatProvider and ignoreCase

Applies to