Allow creating open delegates from instance method groups #4303
Replies: 3 comments
-
The valid syntax with same semantics should be |
Beta Was this translation helpful? Give feedback.
-
I'd also like this to work: new Func<string, string>(string.ToLowerInvariant) The reflection equivalent works: typeof(string).GetMethod("ToLowerInvariant").CreateDelegate(typeof(Func<string, string>)); [Updated the original text.] |
Beta Was this translation helpful? Give feedback.
-
@huoyaoyuan Yes, you can write lambda but that's extra clutter. You'd probably want to use |
Beta Was this translation helpful? Give feedback.
-
Currently C# does not allow to create an open delegate given an method group that has a matching instance method overload like so:
The Reflection API allows such delegate to be created using:
The following should also work:
The reflection equivalent works:
Beta Was this translation helpful? Give feedback.
All reactions