this post was submitted on 16 Feb 2024
6 points (68.8% liked)

C Sharp

1526 readers
31 users here now

A community about the C# programming language

Getting started

Useful resources

IDEs and code editors

Tools

Rules

Related communities

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] notnotmike@programming.dev 3 points 9 months ago (4 children)

Agreed, 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

[–] CCMan1701A@startrek.website 1 points 9 months ago (3 children)

When the if/else is large I'm in the dictionary of functions boat.

[–] mihies@kbin.social 1 points 8 months ago (2 children)

That doesn't sound very effective though.

[–] CCMan1701A@startrek.website 1 points 8 months ago (1 children)

It works for older platforms that only run CF 3.5

[–] mihies@kbin.social 3 points 8 months ago

Is CF still a thing? But anyway, if it works, it works :)