C# Char IsHighSurrogate() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Char

Definition

In C#, Char.IsHighSurrogate returns true for high-surrogate code units (roughly U+D800–U+DBFF).

A complete non-BMP character is a high surrogate followed by a low surrogate. Alone, a high surrogate is incomplete.

This is a static member of System.Char. You call it with the type name, such as Char.IsHighSurrogate(...) or char.IsHighSurrogate(...). A char holds one 16-bit UTF-16 code unit.

Syntax

Pass one code unit to test.

C#
bool ok = Char.IsHighSurrogate(c);
CallWhat it does
Char.IsHighSurrogate(c)True if c is a high surrogate.
Char.IsHighSurrogate(s, i)Tests s[i].

Pair with IsLowSurrogate on the next index.

Library declarations
C#
public static bool IsHighSurrogate(char c);
public static bool IsHighSurrogate(string s, int index);

Parameters

ParameterDescription
cCode unit to test.
s, indexOptional string index overload.

Return Value

Return ValueDescription
trueHigh surrogate.
falseNot a high surrogate.

C# Examples

Example 1 — First Unit of Emoji

Identify the high surrogate in an emoji string.

C#
using System;

class Program {
    static void Main() {
        string emoji = "\U0001F600";
        Console.WriteLine(Char.IsHighSurrogate(emoji, 0));
        Console.WriteLine(Char.IsLowSurrogate(emoji, 1));
    }
}

How It Works

  1. Index 0 high. First half of the pair.
  2. Index 1 low. Second half.
  3. String overload. No need to copy chars first.
  4. Valid pair shape. High then low.

Example 2 — Ordinary Letter

Show that Z is not a high surrogate.

C#
using System;

class Program {
    static void Main() {
        Console.WriteLine(Char.IsHighSurrogate('Z'));
        Console.WriteLine(Char.IsSurrogate('Z'));
    }
}

How It Works

  1. BMP char. Z needs no pair.
  2. Not high. IsHighSurrogate false.
  3. Not surrogate. Broader test also false.
  4. Simple contrast. Everyday letters stay simple.

Example 3 — Skip Pair as Two Units

Advance by 2 when a high surrogate is found.

C#
using System;

class Program {
    static void Main() {
        string s = "X\U0001F600Y";
        int i = 0;
        while (i < s.Length) {
            if (Char.IsHighSurrogate(s, i)) {
                Console.WriteLine("pair at " + i);
                i += 2;
            } else {
                Console.WriteLine("char " + s[i]);
                i++;
            }
        }
    }
}

How It Works

  1. Manual walk. Handle pairs explicitly.
  2. Step by two. After a high surrogate, skip the low one.
  3. Letters alone. X and Y advance by one.
  4. Pair notice. Print where the emoji units start.

Frequently Asked Questions

U+D800 through U+DBFF.
For a valid character, yes.
IsLowSurrogate, IsSurrogatePair, ConvertToUtf32.
No.
Yes.

Next: IsLetter()

Return true when the character is a Unicode letter with System.Char.

IsLetter() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful