2012-01-25 18 views

cevap

3

RichTextBox bir FlowDocument türüdür ve bu Hatları özelliği yoktur. Yaptığınız şey iyi bir çözüm gibi görünüyor. Bölme yerine IndexOf kullanmak isteyebilirsiniz. makale anlaşılacağı gibi

Ayrıca bir uzantısı yöntemi ekleyebilirsiniz:

public static long Lines(this string s) 
{ 
    long count = 1; 
    int position = 0; 
    while ((position = s.IndexOf('\n', position)) != -1) 
     { 
     count++; 
     position++;   // Skip this occurance! 
     } 
    return count; 
} 
İlgili konular