日期:2014-05-17  浏览次数:20441 次

如何只取记事本最后一条记录
记事本内容
60E92A7CFE42B77977F5F4B7C8AAC1F2
B0185E369B0452C2BE70B5F2440624BC
34E26006708761E85D7CE95B7B901A99
34E26006708761E85D7CE95B7B901A99
9D62D71C95149631DD09CC5053D6C4B6
B213C72D2FACE5322221F5947F55393C
如何只取到最后的B213C72D2FACE5322221F5947F55393C这个记录?求高手相助

------解决方案--------------------
streamReader,判断eof
------解决方案--------------------
var array = @"60E92A7CFE42B77977F5F4B7C8AAC1F2
B0185E369B0452C2BE70B5F2440624BC
34E26006708761E85D7CE95B7B901A99
34E26006708761E85D7CE95B7B901A99
9D62D71C95149631DD09CC5053D6C4B6
B213C72D2FACE5322221F5947F55393C".Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (array.Length > 0)
Console.WriteLine(array[array.Length-1]);
------解决方案--------------------
C# code
string result=File.ReadAllLines(@"C:\Documents and Settings\Administrator\桌面\Test.txt", Encoding.GetEncoding("GB2312")).Last().ToString();
                //B213C72D2FACE5322221F5947F55393C