Remove() public method

public Remove ( CodeParameterDeclarationExpression value ) : void
value CodeParameterDeclarationExpression
return void
		public void Constructor0_Deny_Unrestricted ()
		{
			CodeParameterDeclarationExpressionCollection coll = new CodeParameterDeclarationExpressionCollection ();
			Assert.AreEqual (0, coll.Add (cpde), "Add");
			Assert.AreSame (cpde, coll[0], "this[int]");
			coll.CopyTo (array, 0);
			coll.AddRange (array);
			coll.AddRange (coll);
			Assert.IsTrue (coll.Contains (cpde), "Contains");
			Assert.AreEqual (0, coll.IndexOf (cpde), "IndexOf");
			coll.Insert (0, cpde);
			coll.Remove (cpde);
		}
Ejemplo n.º 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the return type.
		/// </summary>
		/// <param name="parameters">The parameters.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		private CodeParameterDeclarationExpression GetReturnType(
			CodeParameterDeclarationExpressionCollection parameters)
		{
			CodeParameterDeclarationExpression retType = new CodeParameterDeclarationExpression(typeof(void),
				"return");
			foreach (CodeParameterDeclarationExpression exp in parameters)
			{
				if (exp.UserData["retval"] != null && (bool)exp.UserData["retval"] &&
					exp.Type.ArrayRank <=0)
				{	/// Marshalling arrays as return value doesn't work!
					retType = exp;
					parameters.Remove(exp);
					break;
				}
			}

			return retType;
		}
		public void Remove_NotInCollection ()
		{
			CodeParameterDeclarationExpressionCollection coll = new CodeParameterDeclarationExpressionCollection ();
			coll.Remove (new CodeParameterDeclarationExpression ());
		}
		public void Remove_Null ()
		{
			CodeParameterDeclarationExpressionCollection coll = new CodeParameterDeclarationExpressionCollection ();
			coll.Remove ((CodeParameterDeclarationExpression) null);
		}
		public void Remove ()
		{
			CodeParameterDeclarationExpression cpde1 = new CodeParameterDeclarationExpression ();
			CodeParameterDeclarationExpression cpde2 = new CodeParameterDeclarationExpression ();

			CodeParameterDeclarationExpressionCollection coll = new CodeParameterDeclarationExpressionCollection ();
			coll.Add (cpde1);
			coll.Add (cpde2);
			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (cpde1), "#2");
			Assert.AreEqual (1, coll.IndexOf (cpde2), "#3");
			coll.Remove (cpde1);
			Assert.AreEqual (1, coll.Count, "#4");
			Assert.AreEqual (-1, coll.IndexOf (cpde1), "#5");
			Assert.AreEqual (0, coll.IndexOf (cpde2), "#6");
		}