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

GetTextFromTextSource() private static method

private static GetTextFromTextSource ( ITextSource textSource ) : IEnumerable
textSource ITextSource
return IEnumerable
		private static IEnumerable<char> GetTextFromTextSource(ITextSource textSource)
		{
			if (textSource == null)
				throw new ArgumentNullException("textSource");

#if NREFACTORY
			if (textSource is ReadOnlyDocument)
				textSource = textSource.CreateSnapshot(); // retrieve underlying text source, which might be a RopeTextSource
#endif

			var rts = textSource as RopeTextSource;
			if (rts != null)
				return rts.GetRope();

			var doc = textSource as TextDocument;
			if (doc != null)
				return doc.rope;

			return textSource.Text;
		}