public class MainClass{ public static long CountLinesInString(string text) { long count = 1; int start = 0; while ((start = text.IndexOf('\n', start)) != -1) { count++; start++; } return count; } }
String