public override string ToString() { return(string.Format( "SingleLineTextRange ({0}, {1} to {2})", LinePosition.GetIndexString(), BeginCharacterPosition.GetIndexString(), EndCharacterPosition.GetIndexString())); }
/// <summary> /// Gets the beginning and ending character indices in the range for a /// given text. /// </summary> /// <param name="text">The text the characters represent.</param> /// <param name="firstCharacterIndex">Beginning index in the text.</param> /// <param name="lastCharacterIndex">Ending index in the text.</param> public void GetBeginAndEndCharacterIndices( string text, out int firstCharacterIndex, out int lastCharacterIndex) { firstCharacterIndex = BeginCharacterPosition.GetCharacterIndex( text, EndCharacterPosition, WordSearchDirection.Left); lastCharacterIndex = EndCharacterPosition.GetCharacterIndex( text, BeginCharacterPosition, WordSearchDirection.Right); }
public override int GetHashCode() { unchecked { int hashCode = BeginCharacterPosition.GetHashCode(); hashCode = (hashCode * 397) ^ EndCharacterPosition.GetHashCode(); hashCode = (hashCode * 397) ^ LinePosition.GetHashCode(); return(hashCode); } }
public bool Equals(SingleLineTextRange other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(BeginCharacterPosition.Equals(other.BeginCharacterPosition) && EndCharacterPosition.Equals(other.EndCharacterPosition) && LinePosition.Equals(other.LinePosition)); }