public void Add(ref StringLine line) { if (Count == Lines.Length) { IncreaseCapacity(); } Lines[Count++] = line; }
public void Add(StringSlice slice) { if (Count == Lines.Length) { IncreaseCapacity(); } Lines[Count++] = new StringLine(ref slice); }
/// <summary> /// Initializes a new instance of the <see cref="StringLineGroup"/> class. /// </summary> /// <param name="text">The text.</param> /// <exception cref="System.ArgumentNullException"></exception> public StringLineGroup(string text) { if (text == null) { throw new ArgumentNullException(nameof(text)); } Lines = new StringLine[1]; Count = 0; Add(new StringSlice(text)); }
/// <summary> /// Removes the line at the specified index. /// </summary> /// <param name="index">The index.</param> public void RemoveAt(int index) { if (Count - 1 == index) { Count--; } else { Array.Copy(Lines, index + 1, Lines, index, Count - index - 1); Lines[Count - 1] = new StringLine(); Count--; } }