public InlineString(string text) { if (ReferenceEquals(text, null)) { throw new ArgumentNullException("text"); } if (text.Length == 0) { _Contents = EMPTY_CONTENTS; } else { _Contents = new InlineRunWithProperty[] { new InlineRunWithProperty(text) }; } }
/// <summary> /// Creates a new InlineString instance whose contents are identical to anohter inline string. /// </summary> /// <param name="another">Another inline string.</param> /// <remarks><see cref="InlineTag"/> contained in <paramref name="another"/> are cloned.</remarks> public InlineString(InlineString another) { var contents = (InlineRunWithProperty[])another._Contents.Clone(); for (int i = 0; i < contents.Length; i++) { var rwp = contents[i]; var tag = rwp.Run as InlineTag; if (!ReferenceEquals(tag, null)) { // Clone this InlineTag. contents[i] = new InlineRunWithProperty(rwp.Property, tag.Clone()); } } _Contents = contents; }