3 ms·
Well, not sure why that's implemented as is, interop is some old technology and there are quirks or whatever. But .NET provides convenience methods/delegates, l
by jve 5y ago
Well, not sure why that's implemented as is, interop is some old technology and there are quirks or whatever. But .NET provides convenience methods/delegates, like typed Action<>[1] (or Func<>) with 16 arguments, so you don't have to explicitly define delegate yourself:
[1] https://docs.microsoft.com/en-us/dotnet/api/system.action-16?view=net-6.0 https://docs.microsoft.com/en-us/dotnet/api/system.action-16...
Today as of C# 4 you can for example have optional arguments. Not sure if this applies to this method which surely predates C#4.
- cm2187 5y agoThe args for this method are all optional and it would be exposed to C# through a COM API so I’d expect C# to treat them as such.
- contextfree 5y agoThis specific use case was in fact one of the motivations for introducing optional arguments back in C# 4.
- MarkSweep 5y agoAnd if you need more than 16 arguments, as of C# 10 the compiler will synthesize an anonymous delegate type in some cases: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-10.0/lambda-improvements.md#delegate-types https://github.com/dotnet/csharplang/blob/main/proposals/csh...