Linq的delegate表达式,Insus.NET觉得它封装得好,让开发时简化了很多代码,而且容易阅读与检索。

比如,我们需要计算优惠给客户金额,打85%折,可以这样写:
LINQ的Expression与delegate表达式

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Linq.Expressions;

namespace Insus.NET.Utilities
{
    public class Class2
    {
        public decimal Preferential(decimal amount)
        {
            return amount * (1 - 0.85m);  //amount - amount * 0.85m;
        }
    }
}
Source Code

相关文章:

  • 2021-09-21
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
猜你喜欢
  • 2021-10-27
  • 2021-08-08
  • 2021-05-17
  • 2021-05-23
相关资源
相似解决方案