FileStream fs = new FileStream(@"G:\学习笔记\自学内容\读取txt文件\a.txt", FileMode.Open);
StreamReader m_streamReader = new StreamReader(fs);
m_streamReader.BaseStream.Seek(0, SeekOrigin.Begin);
string arry = "";
string strLine = m_streamReader.ReadLine();
do
{
string[] split = strLine.Split(‘=‘);
string a = split[0];
if (a.ToLower() == "ip")
{
arry += strLine + "\n";
}
strLine = m_streamReader.ReadLine();
} while (strLine != null && strLine != "");
m_streamReader.Close();
m_streamReader.Dispose();
fs.Close();
fs.Dispose();
Console.Write(arry);
Console.ReadLine();