PSTypeConverter Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines a base class implemented when you need to customize the type conversion for a target class.
public ref class PSTypeConverter abstract
public abstract class PSTypeConverter
type PSTypeConverter = class
Public MustInherit Class PSTypeConverter
- Inheritance
-
PSTypeConverter
- 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() |
Methods
CanConvertFrom(Object, Type) |
Determines if the converter can convert the |
CanConvertFrom(PSObject, Type) |
Determines if the converter can convert the |
CanConvertTo(Object, Type) |
Returns true if the converter can convert the |
CanConvertTo(PSObject, Type) |
Returns true if the converter can convert the |
ConvertFrom(Object, Type, IFormatProvider, Boolean) |
Converts the |
ConvertFrom(PSObject, Type, IFormatProvider, Boolean) |
Converts the |
ConvertTo(Object, Type, IFormatProvider, Boolean) |
Converts the |
ConvertTo(PSObject, Type, IFormatProvider, Boolean) |
Converts the |