public static bool TryGet(MemberInfo info, out AssignableMember member) { Ensure.Argument.NotNull(info, nameof(info)); var(m, e) = GetImpl(info); member = m; return(e == null); }
private static (AssignableMember member, Exception exception) GetImpl(MemberInfo info) { if (!IsValidMemberType(info.MemberType)) { var e = new ArgumentException( "Only field or property is considered as assignable member.", nameof(info)); return(null, e); } if (!_instances.TryGetValue(info, out var member)) { member = new AssignableMember(info); _instances.Add(info, member); } return(member, null); }
public static bool TryGet(Type type, string memberName, BindingFlags bindingAttr, out AssignableMember member) { var(m, e) = GetImpl(type, memberName, bindingAttr); member = m; return(e == null); }
public static bool TryGet(Type type, string memberName, out AssignableMember member) { return(TryGet(type, memberName, BindingAttributes.All, out member)); }