From the course: Ten Tips for the C# Developer

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Readable literals with the underscore

Readable literals with the underscore - C# Tutorial

From the course: Ten Tips for the C# Developer

Start my 1-month free trial

Readable literals with the underscore

- [Instructor] We've known for centuries that when you ask a human to read a long list of characters or a long set of numbers, it's hard for the human brain to parse that information unless you put separators in the characters. Here's an example on line 16. There's a long set of digits here. If I ask you to look through this for a pattern, let's say the number 49, it might take you a while to find the information. But if we use something like this on line 19, a hyphen, or a comma, or space to split up the information. The brain can process it quicker. Now, when you look for the number 49, it's easy to find it here, and here. Let's think about this. We write code, we use literal values all the time in our code, we use string literals, we use numeric literals. Let's see how we can make our code more readable with separators. Here's the problem, on line 25 I've got a variable. And I'm attempting to assign…

Contents