Corner case in using lambdas expression in base constructor

后端 未结 5 1531
伪装坚强ぢ
伪装坚强ぢ 2021-01-05 08:03

In the Framework we are building we need the following pattern:

public class BaseRenderer
{
    Func renderer;
    public BaseRenderer(Func<         


        
5条回答
  •  逝去的感伤
    2021-01-05 08:27

    As asgerhallas correctly points out, this should not be legal according to the specification. We accidentally allowed this bogus usage to sneak by the error detector that searches for incorrect usages of "this" before it is legal to do so. I've fixed the bug; the C# 4 compiler correctly flags your program as an error.

    Many apologies for the inconvenience; this was my mistake.

提交回复
热议问题