Remove delegate allocation
@kronic Can you explain the benefit of these changes?
@punker76 there will be no allocation for the delegate when called.
@kronic I never saw such a suggestion, also if I look to the official doc. So if you have any information about htis then please show me. Thx
@punker76 https://sharplab.io/#gist:bdaac746f37bcd9bba8436ffeb1e81e4
https://devblogs.microsoft.com/dotnet/understanding-the-cost-of-csharp-delegates/
@kronic Could you elaborate a bit more on what your changes achieve exactly? The value stored in the static metadata should be the same as before. Your changes would reduce allocations if the delegate would be created multiple times, but in case of property metadata this is not the case. As shown in your SharpLab example your changes lead to increased code size and an additional backing field which stores the reference to the delegate. So instead of only storing the delegate instance in the property metadata we now would store it twice, once in the metadata and once in the backing field.