本文基于StackOverflow的以下问题收集整理而成。
What is the fastest waty to count newlines in a large .NET string: http://stackoverflow.com/questions/2557002/what-is-the-fastest-way-to-count-newlines-in-a-large-net-string
How to count lines in a string: http://stackoverflow.com/questions/11189331/how-to-count-lines-in-a-string
方法一
private static int Count1(string s)
{
int len = s.Length;
int c = 0;