Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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...

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.



The 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.


This specific use case was in fact one of the motivations for introducing optional arguments back in C# 4.


And 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/csh...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: