General Performance Tip: Choosing Between Conditional Statements – If, Switch, and Switch Expression Performance in C#

This article compares the performance of conditional if statements, switch statements, and switch expressions in C# code, with a focus on data retrieval.

Microsoft .NET Code Analysis: Use the Switch Expressions Instead of Statements

Switch expressions are a modern and recommended approach for implementing switch statements in .NET Core 3 and later. They offer advantages such as conciseness, expression evaluation, pattern matching, direct return value, exhaustiveness checking, scope isolation, and improved code refactoring and maintainability.