本文整理汇总了C#中IMemberDefinition.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IMemberDefinition.GetType方法的具体用法?C# IMemberDefinition.GetType怎么用?C# IMemberDefinition.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMemberDefinition
的用法示例。
在下文中一共展示了IMemberDefinition.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckMemberAndApplyResults
/// <summary>
/// Check member for obfuscation attribute, and store result in output list
/// </summary>
/// <param name="typeToScan">Type currently scanned</param>
/// <param name="curMember">Member to be scanned for obfuscation attributes</param>
/// <param name="defaultValue">Default value of obfuscation</param>
/// <param name="result">List in which result are transmitted</param>
private void CheckMemberAndApplyResults(TypeDefinition typeToScan, IMemberDefinition curMember, bool? defaultValue, List<Configuration.SkipBase> result)
{
// Only methods of class are to be excluded
if (curMember.DeclaringType.FullName.Equals(typeToScan.FullName))
{
bool toExclude = defaultValue.GetValueOrDefault(false);
System.Reflection.ObfuscationAttribute toFind = this.GetAndStripObfuscationCustomAttribute(curMember);
if (toFind != null)
{
// We have found an Obfuscation attribute, default value doesn't apply
toExclude = toFind.Exclude;
}
if (toExclude)
{
Configuration.SkipElement toAdd = null;
switch (curMember.GetType().FullName)
{
case "Mono.Cecil.EventDefinition":
toAdd = new ObfuscarStandardAttributeHelper.Core.Configuration.SkipEvent();
break;
case "Mono.Cecil.FieldDefinition":
toAdd = new ObfuscarStandardAttributeHelper.Core.Configuration.SkipField();
break;
case "Mono.Cecil.PropertyDefinition":
toAdd = new ObfuscarStandardAttributeHelper.Core.Configuration.SkipProperty();
break;
case "Mono.Cecil.MethodDefinition":
toAdd = new ObfuscarStandardAttributeHelper.Core.Configuration.SkipMethod();
break;
default:
throw new NotImplementedException(string.Format("Type {0} is not suppported", curMember.GetType().FullName));
}
toAdd.Type = typeToScan.FullName;
toAdd.Name = curMember.Name;
result.Add(toAdd);
}
}
}
示例2: IsMatch
public static bool IsMatch(IMemberDefinition member1, IMemberDefinition member2)
{
if (member1.GetType() != member2.GetType()) {
return false;
}
if (member1 is MethodDefinition) {
return MethodMatcher.IsMatch((MethodDefinition)member1, (MethodDefinition)member2);
}
if (member1 is PropertyDefinition) {
return PropertyMatcher.IsMatch((PropertyDefinition)member1, (PropertyDefinition)member2);
}
if (member1 is EventDefinition) {
return EventMatcher.IsMatch((EventDefinition)member1, (EventDefinition)member2);
}
if (member1 is FieldDefinition) {
return FieldMatcher.IsMatch((FieldDefinition)member1, (FieldDefinition)member2);
}
throw new InvalidOperationException();
}