我有一个有效的查询如下:
var result = from sch in schemeDashboard
join exp in Expenditure on sch.schemeId equals exp.SchemeCode
into SchExpGroup
where sch.SectorDepartmentId == selectedDepartmentId &&
sch.YearCode == StateManager.CurrentYear
orderby sch.ADPId
select new
{
ProjectName = sch.schemeName,
ADPNo = sch.ADPId,
Allocation = sch.CurrentAllocation,
Expenditures = from expend in SchExpGroup
where expend.YearCode == StateManager.CurrentYear &&
expend.DepartmentId == selectedDepartmentId &&
InvStatus.Contains(expend.Status)
orderby expend.ADPId
group expend by expend.InvoiceId
};
现在我需要声明&#34;结果&#34; as:System.Linq.IQueryable<...> result = null;
以便我可以在各种If-else块中编写查询并进行少量修改。 (projectName是字符串,ADPNo是int,分配是十进制)。
我尝试过如下:
System.Linq.IQueryable<string, int, decimal,
System.Collections.Generic.IEnumerable<System.Linq.IGrouping<string, Expenditure>>> result = null;
但这会产生错误:The non-generic type 'IQueryable' cannot be used with typed arguments.
有人能指出我正确的方向吗?感谢名单。
答案 0 :(得分:0)
最通用的C#类是类对象。因此,您可以使用对象类型声明列表。
IQueryable <object> result = null;
嗯,我希望它适合你,因为它对我有用。