this post was submitted on 16 Feb 2024
6 points (68.8% liked)
C Sharp
1786 readers
1 users here now
A community about the C# programming language
Getting started
Useful resources
- C# documentation
- C# Language Reference
- C# Programming Guide
- C# Coding Conventions
- .NET Framework Reference Source Code
IDEs and code editors
- Visual Studio (Windows/Mac)
- Rider (Windows/Mac/Linux)
- Visual Studio Code (Windows/Mac/Linux)
Tools
Rules
- Rule 1: Follow Lemmy rules
- Rule 2: Be excellent to each other, no hostility towards users for any reason
- Rule 3: No spam of tools/companies/advertisements
Related communities
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
IMO, it would be more readable to just use
ifs most of the times. But switch-case fallthrough is indeed, interesting behaviourAgreed, multiple if statements are much more readable, in my opinion. I generally think switch statements are always just a little too ugly unless their dead simple.
Switch expressions, on the other hand, are gorgeous code (as long as you don't use expression-bodied cases). I am always looking for chances to use switch expressions. So concise
When the if/else is large I'm in the dictionary of functions boat.
That doesn't sound very effective though.
It works for older platforms that only run CF 3.5
Is CF still a thing? But anyway, if it works, it works :)