Digit Separator - C# Tutorial
C# Course / Version Features / Digit Separator

Digit Separator

BLUF: Mastering Digit Separator is essential for building robust applications with the .NET ecosystem. This tutorial provides clear explanations and practical examples to help you understand and apply this C# concept.
Enterprise Development Tip: Digit Separator

C# is a powerful, modern language for enterprise solutions. Discover how Digit Separator enhances your development workflow in the guide below.

The C# digit separator represents a recent addition in C# 7.0, enabling the segregation of digits with a comma (,) for enhanced readability of numerical values.

When dealing with sizable numeric values, there is a risk of misinterpreting the number. To prevent such inaccuracies, C# introduces the concept of digit separators.

See, the upcoming sample that demonstrates this idea.

C# Digit Separator Example

Example

using System;
namespace CSharpFeatures
{
    class DigitSeperatorExample
    {
        public static void Main(string[] args)
        {
            // Seperating digits using underscore
            int i = 1_00_000;
            double f = 1_00_000; 
            Console.WriteLine(i);
            Console.WriteLine(f);
        }
    }
}

Output:

Output

100000
100000

Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience