Dim sr As System.IO.StreamReader = New System.IO.StreamReader(Application.StartupPath & "\tmp.Txt", System.Text.Encoding.Default) Dim line As String line = sr.ReadLine Me.ToolStripStatusLabel2.Text = line line = sr.R eadLine Me.ToolStripStatusLabel4
FileInfo fi1 = new FileInfo("data\\公汽线路信息.txt"); FileInfo fi2 = new FileInfo("data\\地铁线路信息.txt"); FileInfo fi3 = new FileInfo("data\\地铁T1线换乘公汽信息.txt"); FileInfo fi4 = new FileInfo("data\\地铁T2 线换乘公汽信息.txt"); if (!fi1.Exists) { throw new Exception("《公
本文实例讲述了C#使用StreamReader读取文件的方法。分享给大家供大家参考。具体实现方法如下:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace W
{
class Program
{
static void Main(string[]
好吧,先上图:
这里是TextReder类官方的解释:(http://msdn.microsoft.com/zh-cn/library/system.io.textreader.aspx)
Peek and Read methods to make a useful instance of TextReader. ‘>这里是Stream类官方的解释:(http://msdn.microsoft.com/zh-cn/library/system.io.stream.aspx)
Peek a