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


C# IMemberDefinition.GetType方法代码示例

本文整理汇总了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);
                }
            }
        }
开发者ID:franckleveque,项目名称:ObfuscarStandardAttributeHelper,代码行数:47,代码来源:AssemblyScanner.cs

示例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();
 }
开发者ID:cessationoftime,项目名称:nroles,代码行数:19,代码来源:matchers.cs


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