title: Error While Reading a text file with stream reader
body: <p>1) I'm trying to read a text file but it shows error Like</p>
  
  <blockquote>
    <p><em>foreach statement cannot operate on variables of type 'System.IO.StreamReader' because 'System.IO.StreamReader' does not
    contain a public definition for 'GetEnumerator'</em></p>
  </blockquote>
  
  <p>Here is my <strong>C#</strong> code...</p>
  
  <pre><code> using (StreamReader sr = new StreamReader(@"D:\test1.txt"))
              {
                  while (sr.Peek() &gt;= 0)
                  {
                      //contents of foreach loop go here
  
                          foreach (var line in sr)
                          {
                              var items = line.Split(new[] { '\t', '\n' }).ToArray();
                              if (items.Length != 3)
                                  continue;
                              var Name = items[0].ToString();
                              var Email = items[1].ToString();
                              var Pwd = items[2].ToString();
                              cmd.CommandText = "insert into Employees values('" + Name + "','" + Email + "','" + Pwd + "')";
                              cmd.CommandType = CommandType.Text;
                              cmd.ExecuteNonQuery();
                          }
  
                  }
  </code></pre>