Convert Method Group to Expression

后端 未结 3 1805
情深已故
情深已故 2021-01-17 16:00

I\'m trying to figure out of if there is a simple syntax for converting a Method Group to an expression. It seems easy enough with lambdas, but it doesn\'t translate to meth

3条回答
  •  失恋的感觉
    2021-01-17 16:41

    I use property instead of method.

    public class MathLibrary
    {
        public Expression> AddOne {  
            get {   return input => input + 1;} 
        }
    }
    

    Using above

提交回复
热议问题