pattern_switch.cs

C#Mestre

Explorer

C40
C++40
C#
Iniciante10
Intermediário10
Avançado10
Especialista5
Mestre5
async_enumerable.cs
channel_pipeline.cs
source_generator.cs
span_memory.cs
pattern_switch.cs
Dart40
Go40
Java40
JavaScript40
Kotlin40
Objective-C40
Perl40
PHP40
Python40
R40
Ruby40
Rust40
Shell40
Swift40
TypeScript40
pattern_switch.cs
Click to focus
1
2
3
4
5
6
7
object Process(object input) => input switch {
   string { Length: > 10 } s => s[..10],
   int n when n % 2 == 0 => n / 2,
   List<int> { Count: > 0 } list => list.Average(),
   null => throw new ArgumentNullException(),
   _ => input.ToString()
};
0WPM0%0:000/248(0%)|Ln 1, Col 1
UTF-8C#

Exercícios Relacionados