AddRange() public method

public AddRange ( string range ) : void
range string
return void
		public void Manipulations ()
		{
			CommaDelimitedStringCollection c = new CommaDelimitedStringCollection ();

			c.Add ("1");
			Assert.AreEqual ("1", c.ToString(), "A1");

			c.Add ("2");
			c.Add ("3");
			Assert.AreEqual ("1,2,3", c.ToString(), "A2");

			c.Remove ("2");
			Assert.AreEqual ("1,3", c.ToString(), "A3");

			c.Insert (1, "2");
			Assert.AreEqual ("1,2,3", c.ToString(), "A4");

			c.Clear ();
			Assert.AreEqual (null, c.ToString(), "A5");

			string[] foo = new string[3];
			foo[0] = "1";
			foo[1] = "2";
			foo[2] = "3";
			c.AddRange (foo);
			Assert.AreEqual ("1,2,3", c.ToString(), "A6");
		}
Exemplo n.º 2
0
        public CommaDelimitedStringCollection Clone()
        {
            CommaDelimitedStringCollection col = new CommaDelimitedStringCollection();

            string[] contents = new string[this.Count];
            CopyTo(contents, 0);

            col.AddRange(contents);

            return(col);
        }
Exemplo n.º 3
0
        public CommaDelimitedStringCollection Clone()
        {
            var col      = new CommaDelimitedStringCollection();
            var contents = new string[Count];

            CopyTo(contents, 0);

            col.AddRange(contents);
            col._originalStringHash = _originalStringHash;

            return(col);
        }
		public CommaDelimitedStringCollection Clone ()
		{
			CommaDelimitedStringCollection col = new CommaDelimitedStringCollection();
			string[] contents = new string[this.Count];
			CopyTo (contents, 0);
			
			col.AddRange (contents);
			col.originalStringHash = originalStringHash;

			return col;
		}
		public void RO_AddRange ()
		{
			CommaDelimitedStringCollection c = new CommaDelimitedStringCollection ();
			string[] foo = new string[2];

			foo[0] = "hi";
			foo[1] = "bye";

			c.SetReadOnly ();
			c.AddRange (foo);
		}
Exemplo n.º 6
0
 /// <summary>
 /// Translate a list of days of Month value to a string
 /// </summary>
 /// <param name="daysOfMonth">The list of values</param>
 /// <returns>A string representation of the values, in value1, value2, value3, ... format</returns>
 public static string GenerateDaysOfMonthString(IEnumerable<ushort> daysOfMonth)
 {
     var collection = new CommaDelimitedStringCollection();
     collection.AddRange(daysOfMonth.Select(day => day.ToString()).ToArray());
     return collection.ToString();
 }