尝试运行此代码:
var query= dt.AsEnumerable().GroupBy(row => new
{
Name = row.Field<string>("NAME"),
Id = row.Field<int>("ID")
})
.SelectMany(grp=>
{
var sum=grp.Sum(r => r.Field<decimal>("AMOUNT");
if(sum!=0)
{
DataRow dr = dt.NewRow();
dr["AMOUNT"] = sum;
dr["NAME"] = grp.Key.Name;
dr["ID"] = grp.Key.Id;
return dr;
}
else
{
return grp;
}
}).CopyToDataTable();
并得到这样的错误:
system ( "sox play -n synth 1.0 tri 1000.0" );
在终端中执行此命令时一切正常(我已经安装了sox)。
Xcode clang c ++ 17 macOS High Sierra 10.13