コード例 #1
0
 internal static IMember GetMember(ITypeResolver typeResolver, Type type, MemberType memberTypes, string memberName)
 {
     if (TypeHelper.IsSet(memberTypes, MemberType.Property))
     {
         ITypeId   typeId   = (ITypeId)typeResolver.GetType(type);
         IProperty property = (IProperty)PlatformTypeHelper.GetProperty(typeResolver, typeId, memberTypes & MemberType.Property, memberName);
         if (property != null)
         {
             return((IMember)property);
         }
     }
     if (TypeHelper.IsSet(memberTypes, MemberType.Event))
     {
         IEvent @event = PlatformTypeHelper.GetEvent(typeResolver, type, memberName);
         if (@event != null)
         {
             return((IMember)@event);
         }
     }
     if (TypeHelper.IsSet(memberTypes, MemberType.Field))
     {
         FieldInfo fieldInfo = PlatformTypeHelper.GetFieldInfo(type, memberName);
         if (fieldInfo != (FieldInfo)null)
         {
             return((IMember)FieldReferenceStep.GetReferenceStep(typeResolver, fieldInfo));
         }
     }
     if (TypeHelper.IsSet(memberTypes, MemberType.Method))
     {
         MethodInfo method = PlatformTypeHelper.GetMethod(type, memberName);
         if (method != (MethodInfo)null)
         {
             IType type1 = typeResolver.GetType(method.DeclaringType);
             if (type1 == null)
             {
                 return((IMember)null);
             }
             return((IMember)Method.GetMethod(typeResolver, type1, method));
         }
     }
     return((IMember)null);
 }