本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}