Đọc ghi dữ liệu văn bản C#

Thao tác với dữ liệu văn bản trong C#, đọc và ghi từng dòng

public class TextFile

public TextFile()

public static void Run()

string fileName = Path.GetFullPath(“..\\..\\”) + “\\BinaryData.cs”;
string outFile = Path.GetFullPath(“..\\..\\”) + “\\BinaryData.bak”;

FileStream inputStream = new FileStream(fileName,FileMode.Open,FileAccess.Read);
StreamReader reader = new StreamReader(inputStream);

FileStream outputStream = new FileStream(outFile,FileMode.OpenOrCreate,FileAccess.Write);
StreamWriter writer = new StreamWriter(outputStream);
string text;

text = reader.ReadLine();


while (text!=null);



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s