public LazyMemberInfo(MemberTypes memberType, params MemberInfo[] accessors) { EnsureSupportedMemberType(memberType, nameof(memberType)); Requires.NotNull(accessors, nameof(accessors)); string errorMessage; if (!LazyMemberInfo.AreAccessorsValid(memberType, accessors, out errorMessage)) { throw new ArgumentException(errorMessage, nameof(accessors)); } _memberType = memberType; _accessors = accessors; _accessorsCreator = null; }
public MemberInfo[] GetAccessors() { if ((_accessors == null) && (_accessorsCreator != null)) { MemberInfo[] accessors = _accessorsCreator.Invoke(); string errorMessage; if (!LazyMemberInfo.AreAccessorsValid(MemberType, accessors, out errorMessage)) { throw new InvalidOperationException(errorMessage); } _accessors = accessors; } return(_accessors !); }