Just out of curiosity.
If I have the following Code
public static string Format(dynamic exception)
{
    switch (exception.GetType().ToString())
    {
        case "test":
            return "Test2";
    }
    return null;
}
i get the error "A switch expression or case label must be a bool, char, string, integral, enum, or corresponding nullable type"
but if i have the following code
public static string Format(dynamic exception)
{
    string test = exception.GetType().ToString();
    switch (test)
    {
        case "test":
            return "Test2";
    }
    return null;
}
everything compiles fine. Whats the Difference if the switch is checking a variable of Type string and ToString()? Or is it because of the Chance to throw an Exception before ToString() is called?
 
     
     
    