ConvertTo Method (Object)

LanguagePrimitives.ConvertTo Method (Object)

Converts an object to a specified type parameter. Introduced in Windows PowerShell 3.0.

Namespace: System.Management.Automation
Assembly: System.Management.Automation (in System.Management.Automation.dll)

Dim valueToConvert As Object
Dim returnValue As T

returnValue = LanguagePrimitives.ConvertTo(valueToConvert)

public static T ConvertTo<T> (
	Object valueToConvert



The type of object to convert to.



The object to convert.

Return Value

The converted object.

Windows PowerShell can use standard Windows PowerShell language converters or custom converters to perform the type conversion. For more information about these converters, possible return values, and exceptions that might be thrown during the conversion process, see ETS Type Conversion.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Target Platforms

© 2015 Microsoft