Click here to Skip to main content
Click here to Skip to main content

Counting lines in a string

, 11 Jan 2012 CPOL
How about using the extension method: return s.Count(c => (c == '\n'));
This is an old version of the currently published tip/trick.

This article is still being written and is not currently available for general viewing.

Please go to the .NET Framework Table of Contents to view the list of available articles in this section.
| Advertise | Privacy | Mobile
Web01 | 2.8.141022.2 | Last Updated 11 Jan 2012
Article Copyright 2012 by George Swan
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid