© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3mo ago•
13 replies
zed

Dynamic evaluation

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

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

I would now expect the variable
b
b
to be of type bool even at compile time. However, hovering over the variable it shows as
dynamic
dynamic
. Why is that? Shouldn't the compiler be able to infer the type? Do I have to use
bool b =
bool b =
here?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Dynamic Width
C#CC# / help
3y ago
✅ Dynamic Buffer
C#CC# / help
3y ago
❔ Dynamic programming
C#CC# / help
3y ago