Reputation: 27955
Code
Type fieldType = typeof(string);
switch(fieldType) {
case typeof(string):
break;
}
Throws compile error
CS9135 A constant value of type 'Type' is expected Eeva
at line
case typeof(string):
How to use Type constants in switch labels?
Using .NET 8 and Visual Studio 17.11.5
Upvotes: 0
Views: 21