December 2026
Every post published in December 2026, newest first. Pick a day to jump straight to it.
- Posts
- 514
- Topics
- 86
- Reading time
- 56 h
- Active days
- 3
Posts 511–514 of 514 · December 1, 2026
Page 18 of 18
Tuesday, December 1, 2026
4 of 97 posts
How to Put an Attribute on a Lambda Parameter in C#
In C#, an attribute can go on a lambda's parameter, written inside the parentheses in front of it. A small example puts Description on the celsius parameter of a Celsius-to-Fahrenheit lambda, prints 100 C is 212 F, reads the description back with reflection, and shows the errors for missing parentheses and a wrong attribute.
6 min readHow to Convert a String to a double with double.Parse in C#
Convert a string to a double in C# with double.Parse and a culture. A small example reads "3.5" and "1.25" with the invariant culture and adds them up to 4.75, then shows why "3.5" read as German became 35, with real output, the FormatException for "$4.99" and Infinity for 1e400.
6 min readHow to Match Several Patterns with or in C#
The or pattern in C# matches a value against several patterns at once, so one switch arm or one is check covers them all. A small example sorts a, b, e and x into vowels and consonants with one arm for all five vowels and checks a grade with is 'A' or 'B', with the errors you get from ||, a variable inside or, and not without parentheses.
6 min readHow to Run Several Tasks at Once and Wait for All of Them with Task.WhenAll in C#
Task.WhenAll in C# waits for several tasks that run at the same time and gives back all their results in the order you passed them in. A small example makes tea, toast and an egg that take 3, 2 and 1 seconds, all done after 3.0 seconds instead of 6, with real output and what happens when two of the tasks throw.
8 min read