title: What is IEnumerable interface in c#? What if we dont use it?
body: <p>Searched in internet for What is IEnumerable interface in C#? The problem it solves? What if we don't use it? But never really did not get much. Lots of posts explain how to implement it.</p>
  <p>I've also found the following example</p>
  <pre><code>List&lt;string&gt; List = new List&lt;string&gt;();
          List.Add(&quot;Sourav&quot;);
          List.Add(&quot;Ram&quot;);
          List.Add(&quot;Sachin&quot;);
  
         
          IEnumerable names = from n in List where (n.StartsWith(&quot;S&quot;)) select n;
          // var names = from n in List where (n.StartsWith(&quot;S&quot;)) select n;
  
          foreach (string name in names)
          {
              Console.WriteLine(name);
          }
  </code></pre>
  <p>The above ex outputs:</p>
  <blockquote>
  <p>Sourav</p>
  <p>Sachin</p>
  </blockquote>
  <p>I wanted to know, the advantage of using IEnumerable in the above example? I can achieve the same using 'var' (commented line).</p>
  <p>I would appreciate if anyone of you can help me out to understand this and whats the benefit of using IEnumerable with an example? What if we don't use it?.</p>