Exemple #1
0
        public sealed override Object GetConstantValue()
        {
#if ENABLE_REFLECTION_TRACE
            if (ReflectionTrace.Enabled)
            {
                ReflectionTrace.PropertyInfo_GetConstantValue(this);
            }
#endif

            if (!(_definingTypeInfo.ReflectionDomain is ExecutionDomain))
            {
                throw new NotSupportedException(); // Cannot instantiate a boxed enum on a non-execution domain.
            }
            Object defaultValue;
            if (!ReflectionCoreExecution.ExecutionEnvironment.GetDefaultValueIfAny(
                    _reader,
                    _propertyHandle,
                    this.PropertyType,
                    this.CustomAttributes,
                    out defaultValue))
            {
                throw new InvalidOperationException();
            }
            return(defaultValue);
        }
Exemple #2
0
        public sealed override Object GetConstantValue()
        {
#if ENABLE_REFLECTION_TRACE
            if (ReflectionTrace.Enabled)
            {
                ReflectionTrace.PropertyInfo_GetConstantValue(this);
            }
#endif
            Object defaultValue;
            if (!DefaultValueProcessing.GetDefaultValueIfAny(_reader, ref _property, this, out defaultValue))
            {
                throw new InvalidOperationException();
            }
            return(defaultValue);
        }
Exemple #3
0
        private object GetConstantValue(bool raw)
        {
#if ENABLE_REFLECTION_TRACE
            if (ReflectionTrace.Enabled)
            {
                ReflectionTrace.PropertyInfo_GetConstantValue(this);
            }
#endif

            object defaultValue;
            if (!GetDefaultValueIfAny(raw, out defaultValue))
            {
                throw new InvalidOperationException(SR.Arg_EnumLitValueNotFound);
            }
            return(defaultValue);
        }
Exemple #4
0
        public sealed override Object GetConstantValue()
        {
#if ENABLE_REFLECTION_TRACE
            if (ReflectionTrace.Enabled)
            {
                ReflectionTrace.PropertyInfo_GetConstantValue(this);
            }
#endif

            Object defaultValue;
            if (!ReflectionCoreExecution.ExecutionEnvironment.GetDefaultValueIfAny(
                    _reader,
                    _propertyHandle,
                    this.PropertyType,
                    this.CustomAttributes,
                    out defaultValue))
            {
                throw new InvalidOperationException();
            }
            return(defaultValue);
        }