The switch statement is a multiway branch statement. It provides an easy way to forward execution to different parts of code based on the value of the expression. String is the only non-integer type which can be used in switch statement.
- Switching on strings can be more costly in term of execution than switching on primitive data types. Therefore, it is good to switch on strings only in cases in which the controlling data is already in string form.
- The comparison perform between String objects in switch statements is case sensitive.
- You must use break statements in switch case.
It is 1
Subject is C#
- Switch Statement in C#
- C# Decision Making (if, if-else, if-else-if ladder, nested if, switch, nested switch)
- Switch Expression in C# 8.0
- C# | Arrays of Strings
- C# | Get the number of strings in StringCollection
- C# | Remove all the strings from the StringCollection
- Interpolated Verbatim Strings in C# 8.0
- C# | Swap two Strings without using third user defined variable
- What is .NET 3-Tier Architecture?
- Cross Join in LINQ
- Comparing two ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> in C#
- Compare two ValueTuple<T1, T2, T3, T4, T5, T6, T7> in C#
- Comparing two ValueTuple<T1, T2, T3, T4, T5, T6> in C#
- Comparing two ValueTuple<T1, T2, T3, T4, T5> in C#
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.