Using delimiters for numeric literals in C# 7.0
January 31, 2018 Leave a comment
Say you need to work with relatively large numbers in your C# code:
int number = 3452123;
Wouldn’t it be nice if you could use some kind of delimiter to indicate the millions, thousands etc? Like in 3,452,123? In C# 7.0 the underscore provides a solution for this:
int number = 3_452_123;
The underscores will be ignored by the compiler.
View all various C# language feature related posts here.