c#,stringreader

Kerim 8/12/2016 0

This Code Demonstrates StringReader

C#
 using System;
using System.IO;
 
class Program
{
    const string text = @"Sanfoundry
offers Training and Competency 
development programs";
    static void Main()
    {
        using (StringReader reader = new StringReader(text))
        {
            int count = 0;
            string textline;
            while ((textline = reader.ReadLine()) != null)
            {
                count  ;
                Console.WriteLine("Line {0}: {1}", count, textline);
            }
            Console.ReadLine();
        }
    }
} 

/*
Here is the output of the C# Program: Line 1 : Sanfoundry Line 2 : Offers Training and Competency Line 3 : development programs

*/

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments