【发布时间】:2015-08-04 22:16:52
【问题描述】:
我想获取性别进行计算,例如男性和女性选项在一列中。我想得到所有男性或所有女性进行计算。
我有一个“计算属性”,它提供了所有项目的列表以及计算。这是代码:
partial void MeanFemale_Compute(ref string result)
{
// Set result to the desired field value
int totalAge = 0;
int count = 0;
foreach (InsuranceQuotation i in his.DataWorkspace.ApplicationData.InsuranceQuotations)
{
totalAge += i.mAge;
count++;
}
if (count != 0)
{
result = (totalAge / count).ToString();
}
}
如何过滤此“计算属性”中的性别。
【问题讨论】:
-
计算属性不给出循环。什么意思?
-
我什至对只有一个的非泛型算法感兴趣。谢谢。
-
你能用 if 语句过滤吗?
-
与您的问题无关,但您为什么要传递
ref string参数而不是返回字符串值?为什么返回一个字符串而不是一个数字? -
我无法回答你的问题,所以我在这里重新发布了它 - social.msdn.microsoft.com/Forums/vstudio/en-US/…
标签: c# visual-studio-lightswitch lightswitch-2013 lightswitch-2012