コード例 #1
0
 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;
 }
コード例 #2
0
 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);
 }
コード例 #3
0
ファイル: RuntimeType.cs プロジェクト: x97mdr/fitsharp
 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);
 }
コード例 #4
0
ファイル: RuntimeType.cs プロジェクト: nhajratw/fitsharp
 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;
 }