C#C
C#3w ago
zed

Dynamic evaluation

I think I'm misunderstanding something about
dynamic
... so we have this scenario:
dynamic i = 5;
var b = Check<bool>(i);

Here Check is defined like this:
public static bool Check(dynamic i) {
    return i > 3;
}

I would now expect the variable b to be of type bool even at compile time. However, hovering over the variable it shows as
dynamic
. Why is that? Shouldn't the compiler be able to infer the type? Do I have to use bool b = here?
Was this page helpful?