title: Why Char.IsDigit returns true for chars which can't be parsed to int?
body: <p>I often use <a href="http://msdn.microsoft.com/en-us/library/7f0ddtxh%28v=vs.110%29.aspx" rel="nofollow"><code>Char.IsDigit</code></a> to check if a <code>char</code> is a digit which is especially handy in LINQ queries to pre-check <code>int.Parse</code> as here: <code>"123".All(Char.IsDigit)</code>.</p>
  
  <p>But there are chars which are digits but which can't be parsed to <code>int</code> like <code>۵</code>. </p>
  
  <pre><code>// true
  bool isDigit = Char.IsDigit('۵'); 
  
  var cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
  int num;
  // false
  bool isIntForAnyCulture = cultures
      .Any(c =&gt; int.TryParse('۵'.ToString(), NumberStyles.Any, c, out num)); 
  </code></pre>
  
  <p>Why is that? Is my <code>int.Parse</code>-precheck via <code>Char.IsDigit</code> thus incorrect?</p>
  
  <p>There are 310 chars which are digits:</p>
  
  <pre><code>List&lt;char&gt; digitList = Enumerable.Range(0, UInt16.MaxValue)
     .Select(i =&gt; Convert.ToChar(i))
     .Where(c =&gt; Char.IsDigit(c))
     .ToList(); 
  </code></pre>
  
  <p>Here's the implementation of <code>Char.IsDigit</code> in .NET 4 (ILSpy):</p>
  
  <pre><code>public static bool IsDigit(char c)
  {
      if (char.IsLatin1(c))
      {
          return c &gt;= '0' &amp;&amp; c &lt;= '9';
      }
      return CharUnicodeInfo.GetUnicodeCategory(c) == UnicodeCategory.DecimalDigitNumber;
  }
  </code></pre>
  
  <p>So why are there chars that belong to the <a href="http://msdn.microsoft.com/en-us/library/system.globalization.unicodecategory%28v=vs.110%29.aspx" rel="nofollow"><code>DecimalDigitNumber</code>-category</a>(<em>"Decimal digit character, that is, a character in the range 0 through 9..."</em>) which can't be parsed to an <code>int</code> in any culture?</p>