小编Luí*_*usa的帖子

迭代LINQ AnonymousType对象

如何在另一种方法中使用此LINQ的结果并获取属性CountryIDcount

public IQueryable GetRequestsByRegion(string RequestType)
{
        try
        {
            var q = from re in context.RequestExtensions
                    from r in context.Requests
                    where re.ExtensionID == r.ExtraInfoID
                    && r.OriginalRequestID == null
                    && r.RequestType == RequestType
                    group re by new { CountryID = re.CountryID } into grouped
                    select new { CountryID = (int)grouped.Key.CountryID, count = (int)grouped.Count(t => t.CountryID != null) } ;

            return q;
        }
        catch (Exception ex)
        {

        }

        return null;

    }

public void GetAllInformationRequestsByRegion()
    {
        IQueryable dict = GetRequestsByRegion("tab8elem1"); …
Run Code Online (Sandbox Code Playgroud)

c# linq

4
推荐指数
1
解决办法
4779
查看次数

标签 统计

c# ×1

linq ×1