title: Using a string as IEnumerable
body: <p>In .NET for Windows Store Apps &ndash;it seems&ndash; you cannot use strings as Enumerables anymore. The following code works for desktop applications, but not for apps:</p>
  
  <pre><code>public static bool SolelyConsistsOfLetters(string s)
  {
      return s.All(c =&gt; char.IsLetter(c));
  }
  </code></pre>
  
  <p>The error is </p>
  
  <blockquote>
    <p>'string' does not contain a definition for 'All' and no extension method 'All' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>But I'm not missing an assembly reference or <code>using System.Linq;</code>. The following code <strong>does</strong> work:</p>
  
  <pre><code>public static IEnumerable&lt;char&gt; StringAsEnumerable(string s)
  {
      foreach (char c in s)
      {
          yield return c;
      }
  }
  
  public static bool SolelyConsistsOfLetters(string s)
  {
      return StringAsEnumerable(s).All(c =&gt; char.IsLetter(c));
  }
  </code></pre>
  
  <p>The problem is, <code>s as IEnumerable&lt;char&gt;</code> does not work (error: "Cannot convert type 'string' to 'System.Collections.Generic.IEnumerable' (..)") and <code>s.GetEnumerator()</code> is not available.</p>
  
  <p>My questions:</p>
  
  <ol>
  <li>Is there really no elegant way to use strings as Enumerables (without a helper method as above)? I feel like I must be missing something totally obvious.</li>
  <li>Since the string does not behave like an Enumerable, why/how does foreach work here? </li>
  </ol>