2

我在公共程序中有几个 Linq 语句(这里有 2 个):

'this one gets us table like this: "number of tickets, day"
Dim ticketsCreated = From ticket In CreatedTickets
   Group ticket By GroupKey = New With {Key .IssueDate = CDate(ticket.Date).Date}
   Into g = Group Select New 
       With {Key .IssuesCount = g.Count(), Key .IssueDate = GroupKey.IssueDate}

'this one gets us table like this: "number of tickets, day"
Dim ticketsClosed = From ticket In ClosedTickets
    Group ticket By GroupKey = New With {Key .IssueDate = CDate(ticket.Date).Date}
    Into g = Group Select New 
         With {Key .IssuesCount = g.Count(), Key .IssueDate = GroupKey.IssueDate}

我在两个语句中都得到了关于 GroupKey 的以下错误:

Range variable hides a variable in an enclosing block, a previously defined range variable, 
or an implicitly declared variable in a query expression

我没有在我的 Linq 语句之外的任何地方声明名为 GroupKey 的变量。

4

0 回答 0