Char - IsLowSurrogate
Indicates whether the specified object is a low surrogate.
public static void Main() { char [] input = new char[] { 'a', '\uD800', '\uDC00', 'z' }; Console.WriteLine("Is each of the following characters a high surrogate?"); for (int i = 0; i < input.Length; i++) { // C# Extension Method: Char - IsLowSurrogate var result = input[i].IsLowSurrogate(); Console.WriteLine("input[{0}] = {1} ", i, result); } }
View Source
using System; public static partial class Extensions { /// <summary> /// Indicates whether the specified object is a low surrogate. /// </summary> /// <param name="c">The character to evaluate.</param> /// <returns> /// true if the numeric value of the parameter ranges from U+DC00 through U+DFFF; otherwise, false. /// </returns> public static Boolean IsLowSurrogate(this Char c) { return Char.IsLowSurrogate(c); } }