.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

StreamReader using ReadLine

Posted By:SanthoshNathan       Posted Date: November 08, 2010    Points: 15    Category: Visual Studio    URL: http://www.dotnetspark.com  

StreamReader using ReadLine
 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StreamReader.ReadLine
{
    class Program
    {
        static void Main(string[] args)
        {
            FileStream fs2 = File.Create("santhosh.txt");

            StreamWriter w2 = new StreamWriter(fs2);
            w2.Write("Goodbye santhosh");
            w2.Close();

            fs2 = File.Open("santhosh.txt", FileMode.Open, FileAccess.Read, FileShare.None);
            StreamReader r2 = new StreamReader(fs2);
            String t;
            while ((t = r2.ReadLine()) != null)
            {
                Console.WriteLine(t);
            }
            w2.Close();
            fs2.Close();
        }
    }
}


     

Further Readings:

    Responses

    No response found. Be the first to respond this post

    Post Comment

    You must Sign In To post reply
    Find More code samples in C#, ASP.Net, Vb.Net and more Here

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend