Пример #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)
            {
                if (!CanRead)
                {
                    throw new ArgumentException();
                }

                _lazyGetterInvoker = Getter.GetUncachedMethodInvoker(Array.Empty <RuntimeTypeInfo>(), this);
            }
            if (index == null)
            {
                index = Array.Empty <Object>();
            }
            return(_lazyGetterInvoker.Invoke(obj, index));
        }
Пример #2
0
        public sealed override object?GetValue(object?obj, BindingFlags invokeAttr, Binder?binder, object?[]?index, CultureInfo culture)
        {
            if (_lazyGetterInvoker == null)
            {
                if (!CanRead)
                {
                    throw new ArgumentException();
                }

                _lazyGetterInvoker = Getter.GetUncachedMethodInvoker(Array.Empty <RuntimeTypeInfo>(), this);
            }
            index ??= Array.Empty <object>();
            return(_lazyGetterInvoker.Invoke(obj, index, binder, invokeAttr, culture));
        }