PSTypeConverter Class
Namespace: System.Management.Automation
Assembly: System.Management.Automation (in System.Management.Automation)
A Windows PowerShell type converter is needed when Windows PowerShell cannot perform a type conversion for a specific target class by using the standard Windows PowerShell language converters. For more information about the standard Windows PowerShell language converters and the Windows PowerShell type converter, see ETS Type Conversion.
There are two ways of associating the implementation of the PSTypeConverter class with its target class:
-
Through the type configuration file.
-
By applying the TypeConverterAttribute attribute to the target class.
Classes that derive from PSTypeConverter differ from classes that derive from TypeConverter in the following ways:
-
Classes that derive from PSTypeConverter can be applied to a family of types (such as all types derived from the Enum class). Classes derived from TypeConverter can be applied to only one type.
This is done by inspecting the destinationType parameter of the PSTypeConverter and CanConvertFrom methods to see which member of a family type is specified in the sourceValue parameter.
-
The ConvertTo and ConvertFrom methods have formatProvider and ignoreCase parameters for customizing the conversion.
-
The PSTypeConverter class has no ITypeDescriptorContext interface.
-
The PSTypeConverter class is an abstract class.
System.Management.Automation.PSTypeConverter
Microsoft.PowerShell.DeserializingTypeConverter
Microsoft.PowerShell.ScheduledJob.JobTriggerToCimInstanceConverter
System.Management.Automation.ConvertThroughString
Target Platforms
Windows Developer Preview, Windows Server Developer PreviewReference
PSTypeConverter MembersSystem.Management.Automation Namespace
Other Resources
ETS Type ConversionWindows PowerShell SDK
Send comments about this topic to Microsoft.