title: What does the .NET String.Length property return? Surrogate neutral length or complete character length
body: <p>The documentation and language varies between VS 2008 and 2010:</p>
  
  <hr>
  
  <h2>VS 2008 Documentation</h2>
  
  <blockquote>
    <p>Internally, the text is stored as <strong>a readonly collection of Char objects, each of which represents one Unicode character encoded in UTF-16</strong>. ... <strong>The length of a string represents the number of characters regardless of whether the characters are formed from Unicode surrogate pairs or not.</strong> To access the individual Unicode code points in a string, use the StringInfo object. - <a href="http://msdn.microsoft.com/en-us/library/ms228362%28v=vs.90%29.aspx">http://msdn.microsoft.com/en-us/library/ms228362%28v=vs.90%29.aspx</a></p>
  </blockquote>
  
  <hr>
  
  <h2>VS 2010 Documentation</h2>
  
  <blockquote>
    <p>Internally, the text is stored as <strong>a sequential read-only collection of Char objects</strong>. ... <strong>The Length property of a string represents the number of Char objects it contains, not the number of Unicode characters.</strong> To access the individual Unicode code points in a string, use the StringInfo object. - <a href="http://msdn.microsoft.com/en-us/library/ms228362%28v=VS.100%29.aspx">http://msdn.microsoft.com/en-us/library/ms228362%28v=VS.100%29.aspx</a></p>
  </blockquote>
  
  <p>The language used in both cases doesn't clearly differentiate between "character", "Unicode character", "Char class", "Unicode surrogate pair", and "Unicode code point".</p>
  
  <p>The language in the VS2008 documentation stating that a "string represents the number of <em>characters</em> regardless of whether the <em>characters</em> are formed from Unicode surrogate pairs or not" seems to be defining "character" as as object that may be the result of a Unicode surrogate pair, which suggests that it may represent a 4-byte sequence rather than a 2-byte sequence.  It also specifically states at the beginning that a "char" object is encoded in UTF-16, which suggests that it could represent a surrogate pair (being 4 bytes instead of 2).  I'm fairly certain that is wrong though.</p>
  
  <p>The VS2010 documentation is a little more precise.  It draws a distinction between "char" and "Unicode character", but not between "Unicode character" and "Unicode code point".  If a code point refers to half a surrogate pair, and a "Unicode character" represents a full pair, then the "Char" class is named incorrectly, and does not refer to a "Unicode character" at all (which they state it does not), and it's really a Unicode code point.</p>
  
  <p>So are both of the following statements true?  (Yes, I think.)</p>
  
  <ol>
  <li>String.Length represents the Unicode code-point length, and</li>
  <li>String.Length represents neither the Unicode character length nor what we would consider to be a true character length (number of characters that would be displayed), but rather the number of "Char" objects, which each represent a Unicode code point (not a Unicode character).</li>
  </ol>