这是我为jqGrid创建Json响应的代码,以及用于定义单元成员的新关键字,我收到以下消息“找不到隐式类型数组的最佳类型”.
var resRows = results.Select(record => new { id = record.Reference,cell = **new** [] { record.Reference,record.TradeDate.ToShortDateString(),record.Currency1,record.Currency2,record.Notional.ToString(),record.EffectiveDate.ToShortDateString(),record.Quote.ToString() } }).ToArray();
我在这做错了什么?
解决方法
假设Reference,Currency1和Currency2是字符串,只需将其声明为字符串数组:
var resRows = results.Select(record => new { id = record.Reference,cell = new string [] { record.Reference,record.Quote.ToString() } }).ToArray();