コード例 #1
0
ファイル: Visitor.cs プロジェクト: maikahj/NSubstitute
        protected virtual void Visit(TypeDefinition typeDefinition, Context context)
        {
            if (typeDefinition.BaseType != null)
            {
                VisitTypeReference(typeDefinition.BaseType, context.BaseType(typeDefinition));
            }

            foreach (var customAttribute in typeDefinition.CustomAttributes)
            {
                Visit(customAttribute, context.Attribute(typeDefinition));
            }

            foreach (var typeReference in typeDefinition.Interfaces)
            {
                VisitTypeReference(typeReference, context.Interface(typeDefinition));
            }

            foreach (var genericParameter in typeDefinition.GenericParameters)
            {
                Visit(genericParameter, context.GenericParameter(context));
            }

            foreach (var propertyDefinition in typeDefinition.Properties)
            {
                Visit(propertyDefinition, context.Member(typeDefinition));
            }

            foreach (var fieldDefinition in typeDefinition.Fields)
            {
                Visit(fieldDefinition, context.Member(typeDefinition));
            }

            foreach (var eventDefinition in typeDefinition.Events)
            {
                Visit(eventDefinition, context.Member(typeDefinition));
            }

            foreach (var methodDefinition in typeDefinition.Methods)
            {
                Visit(methodDefinition, context.Member(typeDefinition));
            }

            foreach (var nestedType in typeDefinition.NestedTypes)
            {
                Visit(nestedType, context.NestedType(typeDefinition));
            }
        }
コード例 #2
0
 protected virtual void Visit(TypeDefinition typeDefinition, Context context)
 {
     if (typeDefinition.BaseType != null)
     {
         this.VisitTypeReference(typeDefinition.BaseType, context.BaseType(typeDefinition));
     }
     foreach (Mono.Cecil.CustomAttribute attribute in typeDefinition.CustomAttributes)
     {
         this.Visit(attribute, context.Attribute(typeDefinition));
     }
     foreach (InterfaceImplementation implementation in typeDefinition.Interfaces)
     {
         this.Visit(implementation, context.Interface(typeDefinition));
     }
     foreach (GenericParameter parameter in typeDefinition.GenericParameters)
     {
         this.Visit(parameter, context.GenericParameter(context));
     }
     foreach (PropertyDefinition definition in typeDefinition.Properties)
     {
         this.Visit(definition, context.Member(typeDefinition));
     }
     foreach (FieldDefinition definition2 in typeDefinition.Fields)
     {
         this.Visit(definition2, context.Member(typeDefinition));
     }
     foreach (MethodDefinition definition3 in typeDefinition.Methods)
     {
         this.Visit(definition3, context.Member(typeDefinition));
     }
     foreach (EventDefinition definition4 in typeDefinition.Events)
     {
         this.Visit(definition4, context.Member(typeDefinition));
     }
     foreach (TypeDefinition definition5 in typeDefinition.NestedTypes)
     {
         this.Visit(definition5, context.NestedType(typeDefinition));
     }
 }