C# StringReader ReadToEnd
Description
StringReader ReadToEnd
Reads all characters from the
current position to the end of the string and returns them as a single string.
Syntax
StringReader.ReadToEnd
has the following syntax.
public override string ReadToEnd()
Returns
StringReader.ReadToEnd
method returns The content from the current position to the end of the underlying string.
Example
/* ww w . j a v a 2 s . c o m*/
using System;
using System.IO;
using System.Text;
class Program
{
static void Main(string[] args)
{
ReadCharacters();
}
static void ReadCharacters()
{
StringBuilder stringToRead = new StringBuilder();
stringToRead.AppendLine("in 1st line ");
stringToRead.AppendLine("and 2nd line");
stringToRead.AppendLine("and the end from java2s.com");
using (StringReader reader = new StringReader(stringToRead.ToString()))
{
Console.WriteLine(reader.ReadToEnd());
}
}
}