System.Reflection.RtFieldInfo.PerformVisibilityCheckOnField C# (CSharp) Method

PerformVisibilityCheckOnField() private method

private PerformVisibilityCheckOnField ( IntPtr field, Object target, IntPtr declaringType, FieldAttributes attr, uint invocationFlags ) : void
field System.IntPtr
target Object
declaringType System.IntPtr
attr FieldAttributes
invocationFlags uint
return void
        static private extern void PerformVisibilityCheckOnField(IntPtr field, Object target, IntPtr declaringType, FieldAttributes attr, uint invocationFlags);
        #endregion

Usage Example

Esempio n. 1
0
        internal object InternalGetValue(object obj, ref StackCrawlMark stackMark)
        {
            INVOCATION_FLAGS invocationFlags = this.InvocationFlags;
            RuntimeType      runtimeType1    = this.DeclaringType as RuntimeType;

            if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NO_INVOKE) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
            {
                if (runtimeType1 != (RuntimeType)null && this.DeclaringType.ContainsGenericParameters)
                {
                    throw new InvalidOperationException(Environment.GetResourceString("Arg_UnboundGenField"));
                }
                if (runtimeType1 == (RuntimeType)null && this.Module.Assembly.ReflectionOnly || runtimeType1 is ReflectionOnlyType)
                {
                    throw new InvalidOperationException(Environment.GetResourceString("Arg_ReflectionOnlyField"));
                }
                throw new FieldAccessException();
            }
            this.CheckConsistency(obj);
            if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NON_W8P_FX_API) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
            {
                RuntimeAssembly executingAssembly = RuntimeAssembly.GetExecutingAssembly(ref stackMark);
                if ((Assembly)executingAssembly != (Assembly)null && !executingAssembly.IsSafeForReflection())
                {
                    throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_APIInvalidForCurrentContext", (object)this.FullName));
                }
            }
            RuntimeType runtimeType2 = (RuntimeType)this.FieldType;

            if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
            {
                RtFieldInfo.PerformVisibilityCheckOnField(this.m_fieldHandle, obj, this.m_declaringType, this.m_fieldAttributes, (uint)(this.m_invocationFlags & ~INVOCATION_FLAGS.INVOCATION_FLAGS_IS_CTOR));
            }
            return(this.UnsafeGetValue(obj));
        }
All Usage Examples Of System.Reflection.RtFieldInfo::PerformVisibilityCheckOnField