错误不是新的,但我的错误来源并不典型。 我有一个在Tech.CodeGenerator dll中编译的代码。
{
double d = 0;
var linq = from r in table.AsEnumerable()
group r by new
{
_short_date = Convert.ToString(r.Field<object>("short_date")),
_version = Convert.ToString(r.Field<object>("version")),
} into seq
select new
{
seq.Key._short_date,
seq.Key._version,
_value = Double.TryParse(seq.FirstOrDefault().Field<object>("value").ToString(), out d) ? Convert.ToString(seq.Sum(r => Convert.ToDecimal(r.Field<object>("value")))) : Convert.ToString(seq.FirstOrDefault().Field<object>("value")),
};
DataTable res = table.Clone();
foreach (var row in linq)
{
res.Rows.Add(
row._short_date,
row._version,
row._value);
}
return res;
}
我无法理解在这里我向Dictionary添加一个键?以及如何解决它?
var assembly = CodeGenerator.CreateCode<DataTable>(code.ToString()
错误发生在这里,所以我不能确切地说行