Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Counting lines in a string

0.00/5 (No votes)
11 Jan 2012CPOL 8.3K  
How about using the extension method: return s.Count(c => (c == 'n'));
How about using the extension method:
return s.Count(c => (c == '\n'));

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)