Exemple #1
0
        public void TestContains()
        {
            TypeReference tref = dcd.TypeList.Find(
                 delegate(TypeDefinition decl) { return (decl.Name == "NestedClass2Deep"); });
            List<UsedClass> list = new List<UsedClass>();
            UsedClass uc1 = new UsedClass(tref, ClassUse.Calls);
            UsedClass uc2 = new UsedClass(tref, ClassUse.Calls);

            list.Add(uc1);
            Assert.IsTrue(list.Contains(uc1));
            Assert.IsTrue(list.Contains(uc2));
        }
Exemple #2
0
        public override bool Equals(object obj)
        {
            UsedClass operand = obj as UsedClass;

            if (operand == null)
            {
                return(false);
            }
            if (operand.Type == Type && operand.Use == Use)
            {
                return(true);
            }
            return(false);
        }
        private void AddTypeToList(TypeReference tref, ClassUse use, List <UsedClass> usedT, bool getAdditionTypeInfo)
        {
            if (tref != null)
            {
                UsedClass uc = new UsedClass(tref, use);

                if (!SkipType(tref) && !usedT.Contains(uc))
                {
                    usedT.Add(uc);
                }
                if (getAdditionTypeInfo)
                {
                    AddUsedTypesFromAttributes(tref.CustomAttributes, usedT);
                    GenericInstanceType git = tref as GenericInstanceType;
                    AddUsedTypesFromGenericArgs(git, usedT);
                }
            }
        }
        private void AddTypeToList(TypeReference tref, ClassUse use, List<UsedClass> usedT, bool getAdditionTypeInfo)
        {
            if (tref != null)
            {
                UsedClass uc = new UsedClass(tref, use);

                if (!SkipType(tref) && !usedT.Contains(uc))
                {
                    usedT.Add(uc);
                }
                if (getAdditionTypeInfo)
                {
                    AddUsedTypesFromAttributes(tref.CustomAttributes, usedT);
                    GenericInstanceType git = tref as GenericInstanceType;
                    AddUsedTypesFromGenericArgs(git, usedT);
                }
            }
        }