Remove() public method

public Remove ( CodeAttributeDeclaration value ) : void
value CodeAttributeDeclaration
return void
		public void Constructor0_Deny_Unrestricted ()
		{
			CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
			Assert.AreEqual (0, coll.Add (cad), "Add");
			Assert.AreSame (cad, coll[0], "this[int]");
			coll.CopyTo (array, 0);
			coll.AddRange (array);
			coll.AddRange (coll);
			Assert.IsTrue (coll.Contains (cad), "Contains");
			Assert.AreEqual (0, coll.IndexOf (cad), "IndexOf");
			coll.Insert (0, cad);
			coll.Remove (cad);
		}
		public void Remove_Null ()
		{
			CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
			coll.Remove ((CodeAttributeDeclaration) null);
		}
		public void Remove_NotInCollection ()
		{
			CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
			coll.Remove (new CodeAttributeDeclaration ());
		}
		public void Remove ()
		{
			CodeAttributeDeclaration cad1 = new CodeAttributeDeclaration ();
			CodeAttributeDeclaration cad2 = new CodeAttributeDeclaration ();

			CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
			coll.Add (cad1);
			coll.Add (cad2);
			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (cad1), "#2");
			Assert.AreEqual (1, coll.IndexOf (cad2), "#3");
			coll.Remove (cad1);
			Assert.AreEqual (1, coll.Count, "#4");
			Assert.AreEqual (-1, coll.IndexOf (cad1), "#5");
			Assert.AreEqual (0, coll.IndexOf (cad2), "#6");
		}
Example #5
0
        /// <summary>
        /// Removes the default XML attributes.
        /// </summary>
        /// <param name="customAttributes">
        /// The custom Attributes.
        /// </param>
        protected virtual void RemoveDefaultXmlAttributes(CodeAttributeDeclarationCollection customAttributes)
        {
            var codeAttributes = new List<CodeAttributeDeclaration>();
            foreach (var attribute in customAttributes)
            {
                var attrib = attribute as CodeAttributeDeclaration;
                if (attrib == null)
                {
                    continue;
                }

                if (attrib.Name == "System.Xml.Serialization.XmlAttributeAttribute" ||
                    attrib.Name == "System.Xml.Serialization.XmlIgnoreAttribute" ||
                    attrib.Name == "System.Xml.Serialization.XmlTypeAttribute" ||
                    attrib.Name == "System.Xml.Serialization.XmlElementAttribute" ||
                    attrib.Name == "System.CodeDom.Compiler.GeneratedCodeAttribute" ||
                    attrib.Name == "System.Xml.Serialization.XmlRootAttribute")
                {
                    codeAttributes.Add(attrib);
                }
            }

            foreach (var item in codeAttributes)
            {
                customAttributes.Remove(item);
            }
        }
Example #6
0
        /// <summary>
        /// Removes the debug attributes.
        /// </summary>
        /// <param name="customAttributes">The custom attributes Collection.</param>
        protected virtual void RemoveDebugAttributes(CodeAttributeDeclarationCollection customAttributes)
        {
            var codeAttributes = new List<CodeAttributeDeclaration>();
            foreach (var attribute in customAttributes)
            {
                var attrib = attribute as CodeAttributeDeclaration;
                if (attrib == null)
                {
                    continue;
                }

                if (attrib.Name == "System.Diagnostics.DebuggerStepThroughAttribute")
                {
                    codeAttributes.Add(attrib);
                }
            }
            //DCM: OK not sure why it in this loop other than its like a transaction.
            //Not going to touch it now.
            foreach (var item in codeAttributes)
            {
                customAttributes.Remove(item);
            }
        }