}
[CLSCompliant(false)]
- [MonoTODO("Not implemented")]
public virtual object GetValueDirect (TypedReference obj)
{
- throw new NotImplementedException ();
+ throw new NotSupportedException(Environment.GetResourceString("NotSupported_AbstractNonCLS"));
}
[CLSCompliant(false)]
- [MonoTODO("Not implemented")]
public virtual void SetValueDirect (TypedReference obj, object value)
{
- throw new NotImplementedException ();
+ throw new NotSupportedException(Environment.GetResourceString("NotSupported_AbstractNonCLS"));
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Diagnostics;
+using System.Diagnostics.Contracts;
namespace System.Reflection {
bool domainInitialized = false;
RuntimeFieldHandle.SetValue (this, obj, value, null, Attributes, null, ref domainInitialized);
}
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ public override void SetValueDirect(TypedReference obj, Object value)
+ {
+ if (obj.IsNull)
+ throw new ArgumentException(Environment.GetResourceString("Arg_TypedReference_Null"));
+ Contract.EndContractBlock();
+
+ unsafe
+ {
+ // Passing TypedReference by reference is easier to make correct in native code
+ RuntimeFieldHandle.SetValueDirect(this, (RuntimeType)FieldType, &obj, value, (RuntimeType)DeclaringType);
+ }
+ }
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ public override Object GetValueDirect(TypedReference obj)
+ {
+ if (obj.IsNull)
+ throw new ArgumentException(Environment.GetResourceString("Arg_TypedReference_Null"));
+ Contract.EndContractBlock();
+
+ unsafe
+ {
+ // Passing TypedReference by reference is easier to make correct in native code
+ return RuntimeFieldHandle.GetValueDirect(this, (RuntimeType)FieldType, &obj, (RuntimeType)DeclaringType);
+ }
+ }
}
[Serializable]
using System.Globalization;
using System.Runtime.Serialization;
using System.Runtime.ConstrainedExecution;
+using System.Diagnostics.Contracts;
namespace System
{
{
return (IntPtr) (unchecked (((byte *) pointer) - offset));
}
+
+ // fast way to compare IntPtr to (IntPtr)0 while IntPtr.Zero doesn't work due to slow statics access
+ [Pure]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal unsafe bool IsNull()
+ {
+ return m_value == null;
+ }
}
}
{
SetValueInternal (field, obj, value);
}
+
+ unsafe internal static Object GetValueDirect (RtFieldInfo field, RuntimeType fieldType, void *pTypedRef, RuntimeType contextType)
+ {
+ throw new NotImplementedException ("GetValueDirect");
+ }
+
+ unsafe internal static void SetValueDirect (RtFieldInfo field, RuntimeType fieldType, void* pTypedRef, Object value, RuntimeType contextType)
+ {
+ throw new NotImplementedException ("SetValueDirect");
+ }
}
}
return value.type;
}
+ internal bool IsNull {
+ get {
+ return value.IsNull () && klass.IsNull ();
+ }
+ }
+
[MethodImpl (MethodImplOptions.InternalCall)]
public extern static object ToObject (TypedReference value);