csharp csharp read text from a certain line number from string

Code Example - csharp csharp read text from a certain line number from string

                
                        string GetLine(string text, int lineNo) 
{ 
  string[] lines = text.Replace("\r","").Split('\n'); 
  return lines.Length >= lineNo ? lines[lineNo-1] : null; 
}
                    
                
 

csharp read lines number 3 from string

                        
                                string line = File.ReadLines(FileName).Skip(14).Take(1).First();