public Maybe<RuntimeMember> Match(IEnumerable<MemberInfo> members) { if (!specification.IsGetter) return Maybe<RuntimeMember>.Nothing; foreach (var memberInfo in members) { if (memberInfo.Name != "get_Item") continue; RuntimeMember indexerMember = new IndexerMember(memberInfo, instance, specification.MemberName); if (indexerMember.MatchesParameterCount(1) && indexerMember.GetParameterType(0) == typeof(string)) { return new Maybe<RuntimeMember>(indexerMember); } } return Maybe<RuntimeMember>.Nothing; }
public Maybe <RuntimeMember> Match(IEnumerable <MemberInfo> members) { if (!specification.IsGetter) { return(Maybe <RuntimeMember> .Nothing); } foreach (var memberInfo in members) { if (memberInfo.Name != "get_Item") { continue; } RuntimeMember indexerMember = new IndexerMember(memberInfo, instance, specification.MemberName); if (indexerMember.MatchesParameterCount(1) && indexerMember.GetParameterType(0) == typeof(string)) { return(new Maybe <RuntimeMember>(indexerMember)); } } return(Maybe <RuntimeMember> .Nothing); }
RuntimeMember FindIndexerMember(object instance, Type targetType) { if (parameterCount != 0) { return(null); } foreach (MemberInfo memberInfo in targetType.GetMembers(flags | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.FlattenHierarchy)) { if (memberInfo.Name != "get_Item") { continue; } RuntimeMember indexerMember = new IndexerMember(memberInfo, instance, memberName.SourceName); if (indexerMember.MatchesParameterCount(1) && indexerMember.GetParameterType(0) == typeof(string)) { return(indexerMember); } } return(null); }
RuntimeMember FindIndexerMember(object instance, Type targetType) { if (parameterCount != 0) return null; foreach (MemberInfo memberInfo in targetType.GetMembers(flags | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.FlattenHierarchy)) { if (memberInfo.Name != "get_Item") continue; RuntimeMember indexerMember = new IndexerMember(memberInfo, instance, memberName.SourceName); if (indexerMember.MatchesParameterCount(1) && indexerMember.GetParameterType(0) == typeof(string)) { return indexerMember; } } return null; }