在arraylist中获取IQueryable结果视图值

时间:2013-11-21 09:17:18

标签: linq iqueryable

我的代码:

IQueryable grpdRows;
grpdRows = dtInput
    .Select("", "partno")
    .AsQueryable()
    .GroupBy("new (iif(it[\"partno\"] == null, \"\", it[\"partno\"]) as GrpKey1)","it")
    .Select("new (it.Key.GrpKey1 as GrpKey1, it.Count() as TotalCount")");

我需要在grpdRows中获得“arrayList”结果视图。

1 个答案:

答案 0 :(得分:0)

我认为这段代码可能会对您有所帮助:

IList<string> list = new List<string>
{
    "Value1",
    "Value2",
    "Value3",
    "Value4"
};

IQueryable query = list.AsQueryable();
ArrayList arrayList = new ArrayList(query.Cast<string>().ToList());

您提供的代码不足,因此我使用string代替了我的示例。