Esempio n. 1
0
        public sealed override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
        {
#if ENABLE_REFLECTION_TRACE
            if (ReflectionTrace.Enabled)
            {
                ReflectionTrace.PropertyInfo_GetValue(this, obj, index);
            }
#endif
            binder.EnsureNotCustomBinder();

            if (_lazyGetterInvoker == null)
            {
                MethodHandle getterMethodHandle;
                if (!GetAccessor(MethodSemanticsAttributes.Getter, out getterMethodHandle))
                {
                    throw new ArgumentException();
                }
                MethodAttributes getterMethodAttributes = getterMethodHandle.GetMethod(_reader).Flags;
                _lazyGetterInvoker = ReflectionCoreExecution.ExecutionEnvironment.GetMethodInvoker(_reader, _contextTypeInfo, getterMethodHandle, Array.Empty <RuntimeTypeInfo>(), this);
            }
            if (index == null)
            {
                index = Array.Empty <Object>();
            }
            return(_lazyGetterInvoker.Invoke(obj, index));
        }
Esempio n. 2
0
        public sealed override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
        {
#if ENABLE_REFLECTION_TRACE
            if (ReflectionTrace.Enabled)
            {
                ReflectionTrace.PropertyInfo_GetValue(this, obj, index);
            }
#endif
            binder.EnsureNotCustomBinder();

            if (_lazyGetterInvoker == null)
            {
                if (!CanRead)
                {
                    throw new ArgumentException();
                }

                _lazyGetterInvoker = Getter.GetUncachedMethodInvoker(Array.Empty <RuntimeTypeInfo>(), this);
            }
            if (index == null)
            {
                index = Array.Empty <Object>();
            }
            return(_lazyGetterInvoker.Invoke(obj, index));
        }
Esempio n. 3
0
        public sealed override Object GetValue(Object obj, Object[] index)
        {
            if (ReflectionTrace.Enabled)
            {
                ReflectionTrace.PropertyInfo_GetValue(this, obj, index);
            }

            if (_lazyGetterInvoker == null)
            {
                MethodHandle getterMethodHandle;
                if (!GetAccessor(MethodSemanticsAttributes.Getter, out getterMethodHandle))
                {
                    throw new ArgumentException();
                }
                MethodAttributes getterMethodAttributes = getterMethodHandle.GetMethod(_reader).Flags;
                _lazyGetterInvoker = ReflectionCoreExecution.ExecutionEnvironment.GetMethodInvoker(_reader, _contextTypeInfo.RuntimeType, getterMethodHandle, Array.Empty <RuntimeType>(), this);
            }
            if (index == null)
            {
                index = Array.Empty <Object>();
            }
            return(_lazyGetterInvoker.Invoke(obj, index));
        }