title: How to get the line number of specific text in string in c#
body: <p>I have a string which contains so many lines in it.Now as per my requirement i have to search a substring(text) into this string and find out the line number in which this substring(text) exists in the string.</p>
  
  <p>Once i will get the line number i have to read that line and get to know Which contents in it is Character and what is integer or digits.</p>
  
  <p>This is the code that i am using to read a specific line ..</p>
  
  <pre><code>private static string ReadLine(string text, int lineNumber)
  {
      var reader = new StringReader(text);
  
      string line;
      int currentLineNumber = 0;
  
      do
      {
          currentLineNumber += 1;
          line = reader.ReadLine();
      }
      while (line != null &amp;&amp; currentLineNumber &lt; lineNumber);
  
      return (currentLineNumber == lineNumber) ? line : string.Empty;
  }
  </code></pre>
  
  <p>But how to search the line number which contain specific text(substring)?</p>