Use C# 'using' keyword rather than nested try/finally blocks for IDisposable classes.
Be explicit about use of ordinal string comparison.
Throw ArgumentNullException when parameter is null.
Fix typographical error (missing space) in function summary.
Fix exception message when converting UTF-8 into UCS-2. The error message indicated the UTF-8 encoding is invalid simply because the Unicode code point encoded was greater than 0xFFFF. As an example, UTF-8 supports 4-byte character encodings for characters such as U+1F355 (🍕, aka "SLICE OF PIZZA"). Therefore, the error message should instead indicate the code point would not fit into USC-2 encoding....
Use C# 'using' keyword rather than nested try/finally blocks for IDisposable classes. Be explicit about use of ordinal string comparison. Throw ArgumentNullException when parameter is null. Fix typographical error (missing space) in function summary.
Fix exception message when converting UTF-8 into UCS-2. The error message indicated the UTF-8 encoding is invalid simply because the Unicode code point encoded was greater than 0xFFFF. As an example, UTF-8 supports 4-byte character encodings for characters such as U+1F355 (🍕, aka "SLICE OF PIZZA"). Therefore, the error message should instead indicate the code point would not fit into USC-2 encoding....