internal object GetValue() { object v = avm.get_m_value(this); Type vtype = GetValueType(); Function f = vtype.m_box; if (f != null) { return(f.call(null, v)); } f = vtype.m_copy; //int64 return(f.call(null, v)); }
internal void SetValue(object value) { if (value == null) { throw new ArgumentNullException("value"); } Enum e = value as Enum; if (e != null) { value = e.GetValue(); } Type vtype = GetValueType(); try { Function f = vtype.m_unbox; if (f != null) { object v = f.call(null, value); avm.set_m_value(this, v); return; } avm.set_m_value(this, value); } catch (Exception) { throw new InvalidCastException("Value type is " + value.GetType() + ", but enum value type is " + vtype); } }