Replies: 3 comments
-
Method groups aren't a type in C# and you can't capture them in a variable without an explicit delegate type. Even ignoring issues with overloading there would still be any number of potential delegate types that could match the signature of that method. To make this seem more like Python you'd probably have to have the compiler emit some synthetic type that wraps all of the possible methods and binds to them at runtime. Probably not worth the effort. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer. @HaloFour |
Beta Was this translation helpful? Give feedback.
-
You can leave this issue open. I'm just giving some background as to why you probably can't use a method group directly as a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I think there is a bug (or this is a feature request) that should be fixed to enable us to use the dynamic type more python-like.
Normally, Func typed object can be converted to dynamic type. However, when I try to convert a function to dynamic type, it throws a compile-time error.
But why is that?
Is it because it can't directly convert it to dynamic type, it needs an intermediate step first function to Func then to dynamic type?
I think this is a small issue, but should be fixed.
Beta Was this translation helpful? Give feedback.
All reactions