共用方式為


Conversions.ChangeType(Object, Type) 方法

定義

將物件轉換成指定的型別。

public:
 static System::Object ^ ChangeType(System::Object ^ Expression, Type ^ TargetType);
public static object ChangeType (object Expression, Type TargetType);
public static object? ChangeType (object? Expression, Type TargetType);
static member ChangeType : obj * Type -> obj
Public Shared Function ChangeType (Expression As Object, TargetType As Type) As Object

參數

Expression
Object

要轉換的物件。

TargetType
Type

要將物件轉換成的型別。

傳回

指定之目標型別的物件。

適用於