C# Char IsBetween() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Char

Definition

In C#, Char.IsBetween returns true when a character is greater than or equal to a low bound and less than or equal to a high bound (UTF-16 order).

Available in .NET 7+. Handy for inclusive ranges such as 'A'–'Z' or '0'–'9'.

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

Syntax

Pass the value, then the inclusive minimum and maximum.

C#
bool ok = Char.IsBetween(c, 'A', 'Z');
CallWhat it does
Char.IsBetween(c, 'A', 'Z')True if c is between A and Z inclusive.
Char.IsBetween(c, '0', '9')True if c is an ASCII digit.

Bounds are inclusive. Order the arguments as low then high.

Library declarations
C#
public static bool IsBetween(char c, char minInclusive, char maxInclusive);

Parameters

ParameterDescription
cCharacter to test.
minInclusiveLower bound (included).
maxInclusiveUpper bound (included).

Return Value

Return ValueDescription
truec is inside the inclusive range.
falseOutside the range.

C# Examples

Example 1 — A–Z Check

Test whether characters fall in A–Z.

C#
using System;

class Program {
    static void Main() {
        Console.WriteLine(Char.IsBetween('M', 'A', 'Z'));
        Console.WriteLine(Char.IsBetween('m', 'A', 'Z'));
    }
}

How It Works

  1. Upper M. Inside A–Z.
  2. Lower m. Outside that uppercase range.
  3. Inclusive bounds. A and Z themselves would also pass.
  4. .NET 7+. Newer convenience API.

Example 2 — 0–9 Check

Validate ASCII digits with IsBetween.

C#
using System;

class Program {
    static void Main() {
        char c = '7';
        Console.WriteLine(Char.IsBetween(c, '0', '9'));
        Console.WriteLine(Char.IsAsciiDigit(c));
    }
}

How It Works

  1. Seven in range. Between 0 and 9.
  2. AsciiDigit agrees. Same idea for digits.
  3. Inclusive. 0 and 9 are valid.
  4. Readable range. IsBetween states the interval clearly.

Example 3 — Between G and P

Use a custom inclusive letter window.

C#
using System;

class Program {
    static void Main() {
        foreach (char ch in "GHOST") {
            Console.WriteLine(ch + ": " + Char.IsBetween(ch, 'G', 'P'));
        }
    }
}

How It Works

  1. Window G–P. Inclusive letter band.
  2. GHOST scan. Each letter tested.
  3. S and T out. Beyond P.
  4. Custom filters. Not limited to A–Z helpers.

Frequently Asked Questions

Yes.
.NET 7+.
No—UTF-16 code unit order.
Yes: IsBetween(c, '0', '9').
c >= min && c <= max.

Next: IsControl()

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

IsControl() 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.

15 people found this page helpful