SHARE:

C# 13: Introducing the new escape sequence

Introduction

C# 13 quietly introduced a new escape sequence that’ll make terminal and low-level devs smile: \e. Until now, if you wanted to insert the ASCII Escape character (U+001B), you had to use either \u001b or \x1b, both a bit verbose and not exactly readable at a glance.

What’s new ?

The screen capture below shows a code tha print in a Console program a text in red before and with C# 13:

When you execute it it gives:

If you’re building console apps, using ANSI codes for colors, or working close to the terminal — this change is a small but welcome boost to readability.

Simple. Useful. Long overdue 🙂

Written by

anthonygiretti

Anthony is a specialist in Web technologies (14 years of experience), in particular Microsoft .NET and learns the Cloud Azure platform. He has received twice the Microsoft MVP award and he is also certified Microsoft MCSD and Azure Fundamentals.