IDebugConvert.ToPrimitive(Object, TypeCode, Boolean) 方法

定义

在类中实现时,将指定的值转换为指定的 TypeCode,并允许数据丢失(可选)。When implemented in a class, converts the specified value to the specified TypeCode, optionally allowing data loss.

此 API 支持产品基础结构,不能在代码中直接使用。

public:
 System::Object ^ ToPrimitive(System::Object ^ value, TypeCode typeCode, bool truncationPermitted);
public object ToPrimitive (object value, TypeCode typeCode, bool truncationPermitted);
abstract member ToPrimitive : obj * TypeCode * bool -> obj
Public Function ToPrimitive (value As Object, typeCode As TypeCode, truncationPermitted As Boolean) As Object

参数

value
Object

要转换为新类型的值。The value to convert to a new type.

typeCode
TypeCode

value 所要转换到的类型。The type to convert value to.

truncationPermitted
Boolean

如果允许数据丢失,则为 true;否则为 falsetrue to allow data loss; otherwise, false.

返回

Object

转换为 value 类型的 typeCodevalue converted to the typeCode type.

适用于

另请参阅