LanguagePrimitives.ConvertTo<T> Method (Object)

 

Updated: April 27, 2016

Applies To: Windows PowerShell

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)

public static T ConvertTo<T>(
	object valueToConvert
)

Parameters

valueToConvert
Type: System.Object

The object to convert.

Return Value

Type: T

The converted object.

Type Parameters

T

The type of object to convert to.

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 [ps].

Return to top

Community Additions

ADD
Show: