using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Messaging;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace test
{
class Program
{
static void Main(string[] args)
{
string s = null;
using (StreamReader sr = new StreamReader(@"C:\Users\lanmage2\Desktop\1212.jpg"))
{
s = sr.ReadToEnd();
Console.WriteLine(s.Count());
}
Console.WriteLine(s.Count());
Console.WriteLine(s.Length);
//Console.WriteLine(sr.ReadToEnd().Length);//sr已经被释放,所以这行代码无效。
Console.ReadLine();
}
}
}
输出效果:
57113
57113
57113