Can't we have something as below?
int n=(s.Split(new char[]{'\n'})).Length;
where n is the number of lines?
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)