|
@@ -65,6 +65,8 @@ namespace System
|
|
}
|
|
}
|
|
if (mStructType <= 1)
|
|
if (mStructType <= 1)
|
|
{
|
|
{
|
|
|
|
+ if (mData == 0)
|
|
|
|
+ return null;
|
|
return Internal.UnsafeCastToObject((void*)mData).GetType();
|
|
return Internal.UnsafeCastToObject((void*)mData).GetType();
|
|
}
|
|
}
|
|
return (Type)Internal.UnsafeCastToObject((void*)(mStructType & ~3));
|
|
return (Type)Internal.UnsafeCastToObject((void*)(mStructType & ~3));
|
|
@@ -343,6 +345,15 @@ namespace System
|
|
return *(T*)(void*)mData;
|
|
return *(T*)(void*)mData;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public bool TryGet<T>(out T value)
|
|
|
|
+ {
|
|
|
|
+ value = default;
|
|
|
|
+ if (VariantType != typeof(T))
|
|
|
|
+ return false;
|
|
|
|
+ value = Get<T>();
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
public Result<Object> GetBoxed()
|
|
public Result<Object> GetBoxed()
|
|
{
|
|
{
|
|
if (IsObject)
|
|
if (IsObject)
|