Interviews2 answers
Which Data Type can Not be Used in switch Case Statement ?
2 Answers
float
Mukesh KumarPosted Sep 3, 2017, 12:49 AM EDT
The governing type of a switch statement is established by the switch
expression. If the type of the switch expression is sbyte, byte, short,
ushort, int, uint, long, ulong, char, string, or an enum-type, then
that is the governing type of the switch statement. Otherwise, exactly
one user-defined implicit conversion (§13.4) must exist from the type
of the switch expression to one of the following possible governing
types: sbyte, byte, short, ushort, int, uint, long, ulong, char,
string. If no such implicit conversion exists, or if more than one such
implicit conversion exists, a compile-time error occurs.
Ajeet MishraPosted Sep 14, 2015, 2:56 AM EDT

