Performance of expression trees

后端 未结 5 1026
别跟我提以往
别跟我提以往 2020-12-30 23:12

My current understanding is that \'hard coded\' code like this:

public int Add(int x, int y) {return x + y;}

will always perform better tha

5条回答
  •  借酒劲吻你
    2020-12-30 23:43

    C# 6.0 now allows you to do this:

    public int Add(int x, int y) => x + y;
    

    instead of:

    public int Add(int x, int y) {return x + y;}
    

    See Method Expressions and Property Expressions

提交回复
热议问题