AvalonStudio.TextEditor.Document.TextDocument.GetText C# (CSharp) Method

GetText() public method

Retrieves the text for a portion of the document.
public GetText ( ISegment segment ) : string
segment ISegment
return string
		public string GetText(ISegment segment)
		{
			if (segment == null)
				throw new ArgumentNullException("segment");
			return GetText(segment.Offset, segment.Length);
		}

Same methods

TextDocument::GetText ( int offset, int length ) : string

Usage Example

		/// <inheritdoc />
		public virtual int IndentLine(TextDocument document, DocumentLine line, int caretOffset)
		{
			if (document == null)
				throw new ArgumentNullException("document");
			if (line == null)
				throw new ArgumentNullException("line");

			var previousLine = line.PreviousLine;
			if (previousLine != null)
			{
				var indentationSegment = TextUtilities.GetWhitespaceAfter(document, previousLine.Offset);
				var indentation = document.GetText(indentationSegment);
				// copy indentation to line
				indentationSegment = TextUtilities.GetWhitespaceAfter(document, line.Offset);
				document.Replace(indentationSegment, indentation);
			}

			return caretOffset;
		}
All Usage Examples Of AvalonStudio.TextEditor.Document.TextDocument::GetText