是否可以从另一个委托.net 调用委托

Is it possible to invoke delegate from another delegate .net

嗨,我需要你的帮助。 我有以下代码:

public class CompensationProvider
{
    private Func<List<Result_CompensationPolicy>, int> _EmployeeIdCount = (a =>
        a.Where(t => !string.IsNullOrEmpty(t.EmployeeId))
            .Select(x => x.EmployeeId)
            .Distinct()
            .Count());

 private Func<List<Result_CompensationPolicy>, string, IEnumerable<HandlerCompanyCompensationSummery>> _GroupCompensationBalanceByHandler = ((compensationPolicy, managmentCompanyId) =>
             (from p in compensationPolicy
              where string.Compare(p.AccountIdentificationNumber, managmentCompanyId, true) == 0
              group p by p.HandlerIdentificationNumber into g
              select new HandlerCompanyCompensationSummery
              {
                  AnsweringStatus = g.FirstOrDefault().AnswerStatus == (int)EventsAnsweringStatus.CompanySentFeedbackB ? g.FirstOrDefault().ErrorDescription : GetStstusText(g.FirstOrDefault().AnswerStatus),
                  AnsweringStatusId = (EventsAnsweringStatus)g.FirstOrDefault().AnswerStatus,
                  HandlerCompanyName = g.FirstOrDefault(m => !string.IsNullOrEmpty(m.ManufacturerName)).ManufacturerName,
                  HandlerCompanyId = g.FirstOrDefault(m => !string.IsNullOrEmpty(m.HandlerIdentificationNumber)).HandlerIdentificationNumber,
                  AllCompanyProducts = g.Where(p => p.AnswerStatus == (int)EventsAnsweringStatus.CompanySentInfo).Select(x => x.ProductType).Distinct(),
                  EmployeesIdCount =  _EmployeeIdCount(g.ToList()),
                  PoliciesCount = _PoliciesCount(g.ToList()),
                  CompensationSum = _CompensationSum(g.ToList())
              })
            );
}

并在行 EmployeesIdCount = _EmployeeIdCount(g.ToList()) 我收到此错误: 非静态字段方法或 属性.

需要对象引用

为什么?我必须将其设为静态还是有其他解决方案?

先谢谢你

如果它需要使用另一个字段的初始化器的值(这就是这里发生的事情),您需要从构造函数中初始化该字段。您不能在声明时初始化该值。