C# StringReader Tutorial with Programming Examples and Codes

StringReader
In this chapter you will learn:

  • What is StringReader class in C#?
  • Programming Examples and Codes.

What is StringReader Class in C#?

StringReader class implements TextReader class that reads string from string. It enables you to read a string synchronously or asynchronously. You can read a character with Read() method and read a line with ReadLine() method.

Programming Examples and Codes


  • Output

    Line 1: You are reading
    Line 2: this article at
    Line 3: completecsharptutorial.com
    _

    Explanation

    In this program StringReader class reads string from string variable and marks each line with count number and shows display on console.

    Summary

    In this chapter you learned StringReader class in C# with programming examples and codes. In the next chapter you will learn about DirectoryInfo class in C#.


    Leave a Reply

    Your email address will not be published. Required fields are marked *