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 - C# Tutorial
From the course: Ten Tips for the C# Developer
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
-
-
-
Avoid race condition with TryGetValue method1m 46s
-
(Locked)
Better switch statements with pattern matching6m 42s
-
(Locked)
Readable literals with the underscore4m 8s
-
(Locked)
Extract items from sequence with indices9m 8s
-
(Locked)
Discard feature5m 3s
-
(Locked)
Be more functional with the conditional operator2m 42s
-
(Locked)
Create a thread-safe immutable type5m 13s
-
(Locked)
Use the ImmutableList collection4m 14s
-
(Locked)
Show custom debugger information4m 49s
-
(Locked)
Work with nested collections and SelectMany2m 45s
-
-