private protected override void InitializeByRef(PropertyInfo propertyInfo, XBindingFlags flags) { base.InitializeByRef(propertyInfo, flags); declaringType = propertyInfo.DeclaringType; if (_get == null || _set == null) { var getMethod = propertyInfo.GetGetMethod((flags & XBindingFlags.NonPublic) != 0); if (getMethod != null) { var _ref = MethodHelper.CreateDelegate <XClassRefValueHandler <TValue> >(getMethod, false); _get = (obj) => { return(_ref(obj)); }; _set = (obj, value) => { _ref(obj) = value; }; } } }
private protected override void InitializeByValue(PropertyInfo propertyInfo, XBindingFlags flags) { base.InitializeByValue(propertyInfo, flags); declaringType = propertyInfo.DeclaringType; if (_get == null) { var getMethod = propertyInfo.GetGetMethod((flags & XBindingFlags.NonPublic) != 0); if (getMethod != null) { _get = MethodHelper.CreateDelegate <XClassGetValueHandler <TValue> >(getMethod, false); } } if (_set == null) { var setMethod = propertyInfo.GetSetMethod((flags & XBindingFlags.NonPublic) != 0); if (setMethod != null) { _set = MethodHelper.CreateDelegate <XClassSetValueHandler <TValue> >(setMethod, false); } } }
internal override void Initialize(PropertyInfo propertyInfo, XBindingFlags flags) { base.Initialize(propertyInfo, flags); declaringType = propertyInfo.DeclaringType; var getMethod = propertyInfo.GetGetMethod((flags & XBindingFlags.NonPublic) != 0); var setMethod = propertyInfo.GetSetMethod((flags & XBindingFlags.NonPublic) != 0); if (getMethod != null) { _get = MethodHelper.CreateDelegate <XClassGetValueHandler <TValue> >(getMethod, SignatureLevels.Cast); } if (setMethod != null) { _set = MethodHelper.CreateDelegate <XClassSetValueHandler <TValue> >(setMethod, SignatureLevels.Cast); } }
private protected override void InitializeByValue(PropertyInfo propertyInfo, XBindingFlags flags) { base.InitializeByValue(propertyInfo, flags); if ((flags & XBindingFlags.RWAutoPropertyDirectRW) != 0 && TypeHelper.IsAutoProperty(propertyInfo, out var fieldInfo) && fieldInfo != null) { try { var offset = TypeHelper.OffsetOf(fieldInfo); _get = (obj) => Underlying.AddByteOffset(ref TypeHelper.Unbox <TValue>(obj), offset); _set = (obj, value) => Underlying.AddByteOffset(ref TypeHelper.Unbox <TValue>(obj), offset) = value; return; } catch { } } if (_get is null) { var getMethod = propertyInfo.GetGetMethod((flags & XBindingFlags.NonPublic) != 0); if (getMethod != null) { _get = MethodHelper.CreateDelegate <XClassGetValueHandler <TClass, TValue> >(getMethod, false); } } if (_set is null) { var setMethod = propertyInfo.GetSetMethod((flags & XBindingFlags.NonPublic) != 0); if (setMethod != null) { _set = MethodHelper.CreateDelegate <XClassSetValueHandler <TClass, TValue> >(setMethod, false); } } }
internal override void InitializeByRef(PropertyInfo propertyInfo, XBindingFlags flags) { base.InitializeByRef(propertyInfo, flags); declaringType = propertyInfo.DeclaringType; var getMethod = propertyInfo.GetGetMethod((flags & XBindingFlags.NonPublic) != 0); if (getMethod != null) { var _ref = MethodHelper.CreateDelegate <XClassRefValueHandler <TValue> >(getMethod, SignatureLevels.Cast); _get = (obj) => { return(_ref(obj)); }; _set = (obj, value) => { _ref(obj) = value; }; } }