Joa*_*nge 0 .net c# lambda
我正在尝试在C#3中学习lambda,并想知道如何使用lambdas编写这个函数:
假设您有Point3值的集合.
对于这些点中的每一点,p:
创建一个新的p,其中.Y是:
Math.Sin ((center - p).Length * f)
center和f是要提供给函数的外部变量.Point3类型也将有一个带x,y,z值的构造函数.
Dan*_*ker 7
输入集合是source,输出集合是result:
source
result
IEnumerable<Point3> source = ... IEnumerable<Point3> result = source.Select(p => new Point3(p.x, Math.Sin ((center - p).Length * f), p.z);
归档时间:
17 年,5 月 前
查看次数:
158 次
最近记录: