using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Func<string, double, double> funDelegate = CustomCount;
string[] strArry = new string[] { "73.86", "66.25", "95.57", "33.54", "55.05"};
double numSum = ;
numSum = strArry.Sum(s => funDelegate(s, numSum)); Console.WriteLine(numSum); Console.ReadKey();
}
public static double CustomCount(string strNum,double Sum)
{
Sum += Convert.ToDouble(strNum);
return Sum;
} }
}
运行结果: