当前位置: 首页>>代码示例>>C#>>正文


C# ITypeDefinition.GetMembersNamed方法代码示例

本文整理汇总了C#中ITypeDefinition.GetMembersNamed方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeDefinition.GetMembersNamed方法的具体用法?C# ITypeDefinition.GetMembersNamed怎么用?C# ITypeDefinition.GetMembersNamed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITypeDefinition的用法示例。


在下文中一共展示了ITypeDefinition.GetMembersNamed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetHiddenBaseClassMethod

    private static IMethodDefinition GetHiddenBaseClassMethod(IMethodDefinition derivedClassMethod, ITypeDefinition baseClass) {
      Contract.Requires(derivedClassMethod != null);
      Contract.Requires(baseClass != null);

      foreach (ITypeDefinitionMember baseMember in baseClass.GetMembersNamed(derivedClassMethod.Name, false)) {
        IMethodDefinition/*?*/ baseMethod = baseMember as IMethodDefinition;
        if (baseMethod == null) continue;
        if (baseMethod.Visibility == TypeMemberVisibility.Private) continue;
        if ((baseMethod.Visibility == TypeMemberVisibility.Assembly || baseMethod.Visibility == TypeMemberVisibility.FamilyAndAssembly) &&
          !UnitHelper.UnitsAreEquivalent(TypeHelper.GetDefiningUnit(derivedClassMethod.ContainingTypeDefinition), TypeHelper.GetDefiningUnit(baseClass)))
          continue;
        if (!derivedClassMethod.IsHiddenBySignature) return baseMethod;
        if (derivedClassMethod.IsGeneric || baseMethod.IsGeneric) {
          if (derivedClassMethod.GenericParameterCount == baseMethod.GenericParameterCount &&
            IteratorHelper.EnumerablesAreEqual(((ISignature)derivedClassMethod).Parameters, ((ISignature)baseMethod).Parameters, MemberHelper.GenericMethodParameterEqualityComparer))
            return baseMethod;
        } else if (IteratorHelper.EnumerablesAreEqual(((ISignature)derivedClassMethod).Parameters, ((ISignature)baseMethod).Parameters, MemberHelper.ParameterInformationComparer))
          return baseMethod;
      }
      var bases = baseClass.IsInterface ? baseClass.Interfaces : baseClass.BaseClasses;
      foreach (ITypeReference baseClassReference in bases) {
        IMethodDefinition overriddenMethod = GetHiddenBaseClassMethod(derivedClassMethod, baseClassReference.ResolvedType);
        if (!(overriddenMethod is Dummy)) return overriddenMethod;
      }
      return Dummy.MethodDefinition;
    }
开发者ID:xornand,项目名称:cci,代码行数:26,代码来源:Utils.cs

示例2: GetHiddenField

 private static IFieldDefinition GetHiddenField(IFieldDefinition derivedClassField, ITypeDefinition baseClass) {
   foreach (ITypeDefinitionMember baseMember in baseClass.GetMembersNamed(derivedClassField.Name, false)) {
     IFieldDefinition/*?*/ baseField = baseMember as IFieldDefinition;
     if (baseField == null) continue;
     if (baseField.Visibility == TypeMemberVisibility.Private) continue;
     return baseField;
   }
   var bases = baseClass.IsInterface ? baseClass.Interfaces : baseClass.BaseClasses;
   foreach (ITypeReference baseClassReference in bases) {
     IFieldDefinition hiddenField = GetHiddenField(derivedClassField, baseClassReference.ResolvedType);
     if (!(hiddenField is Dummy)) return hiddenField;
   }
   return Dummy.FieldDefinition;
 }
开发者ID:xornand,项目名称:cci,代码行数:14,代码来源:Utils.cs

示例3: GetPropertyNamed

 internal static IPropertyDefinition GetPropertyNamed(ITypeDefinition typeDefinition, IName fieldName) {
   foreach (ITypeDefinitionMember tm in typeDefinition.GetMembersNamed(fieldName, false)) {
     if (tm is IPropertyDefinition)
       return tm as IPropertyDefinition;
   }
   return null;
 }
开发者ID:RUB-SysSec,项目名称:Probfuscator,代码行数:7,代码来源:ModuleReaderTests.cs

示例4: GetEventNamed

 internal static IEventDefinition GetEventNamed(ITypeDefinition typeDefinition, IName eventName) {
   foreach (ITypeDefinitionMember tm in typeDefinition.GetMembersNamed(eventName, false)) {
     if (tm is IEventDefinition)
       return tm as IEventDefinition;
   }
   return null;
 }
开发者ID:RUB-SysSec,项目名称:Probfuscator,代码行数:7,代码来源:ModuleReaderTests.cs

示例5: GetMethodNamed

 internal static IMethodDefinition GetMethodNamed(ITypeDefinition typeDefinition, IName methodName) {
   foreach (ITypeDefinitionMember tm in typeDefinition.GetMembersNamed(methodName, false)) {
     if (tm is IMethodDefinition)
       return tm as IMethodDefinition;
   }
   return null;
 }
开发者ID:RUB-SysSec,项目名称:Probfuscator,代码行数:7,代码来源:ModuleReaderTests.cs

示例6: GetNestedType

 internal static INestedTypeDefinition GetNestedType(ITypeDefinition typeDefinition, IName typeName) {
   foreach (ITypeDefinitionMember tm in typeDefinition.GetMembersNamed(typeName, false)) {
     if (tm is INestedTypeDefinition)
       return tm as INestedTypeDefinition;
   }
   return null;
 }
开发者ID:RUB-SysSec,项目名称:Probfuscator,代码行数:7,代码来源:ModuleReaderTests.cs


注:本文中的ITypeDefinition.GetMembersNamed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。