C# 分布式查询大数据? 比如一个txt 有1G 我先查出来每个汉字出现的次数,有办法吗?
Dictionary<string, int> dict = new Dictionary<string, int>();
fileStream = new FileStream(你的文件, FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fileStream, Encoding.你的文件编码);
string content = sr.ReadLine();
while(content != null)
{
content = sr.ReadLine();
foreach (var c in content)
{
if (!dict.ContainsKey(c)) dict.Add(c, 0);
dict[c]++;
}
}