System::BoxedValue 类

BoxedValue class

表示一个装箱值。此类的对象只能使用 System::MakeObject() 函数分配。切勿在栈上或使用 operator new 创建此类型的实例,因为这会导致运行时错误和/或断言故障。始终将此类包装到 System::SmartPtr 指针中,并使用该指针将其作为参数传递给函数。

template<class T>class BoxedValue : public System::BoxedValueBase
参数描述
T该类表示的装箱值的类型

方法

方法描述
BoxedValue(const T&)构造一个表示指定装箱值的对象。
Equals(ptr) override确定当前对象和指定对象所表示的装箱值是否相等。
GetHashCode() const override返回当前对象的哈希码。
GetType() const override获取对象的实际类型。
GetTypeCode() const override返回表示当前对象所代表的装箱值类型的值。
GetUnsignedLongLongValue() const override如果装箱对象可以被转换,则返回其数值,否则返回零。
is() const确定当前对象所表示的装箱值的类型是否为 V
IsBoxedEnum() override确定当前对象是否表示枚举类型的装箱值。
static Parse(const TypeInfo&, const String&, bool)将指定枚举中具有指定名称的枚举常量的值装箱。一个参数指定在解释指定枚举常量名称的字符串时是否应忽略大小写。
static Parse(const TypeInfo&, const String&)将指定枚举中具有指定名称的枚举常量的值装箱。
ToString() const override将当前对象所表示的装箱值转换为字符串。
ToString(const System::String&) const使用指定的格式字符串将装箱对象转换为字符串。
unbox() const将当前对象所表示的值解箱。

另见