?流是一種讀寫數(shù)據(jù)的抽象概念良姆。
流分為幾種,有文件流幔戏,網(wǎng)絡(luò)流玛追,內(nèi)存流,磁盤流。
流可以進(jìn)行的操作有讀取痊剖,寫入和定位
1 ? streamReader 按行讀取文本文件信息,默認(rèn)編碼方式為UTF-8
string line="";
streamReader? sr=new streamReader(filePath);
while((line=sr.ReadLine()) ?!=null){
?console.writeLine( line );
}
2 ?streamWrite 按行為文件 寫入文本數(shù)據(jù)
二進(jìn)制 文件的讀寫用 BinaryReader 和BinaryWriter
有對(duì)應(yīng)各種數(shù)據(jù)類型的方法韩玩,ReadInt,ReadByte,WriteInt,WriteByte等等