Märkus.
Juurdepääs sellele lehele nõuab autoriseerimist. Võite proovida sisse logida või kausta vahetada.
Juurdepääs sellele lehele nõuab autoriseerimist. Võite proovida kausta vahetada.
Expected contextual keyword 'by'
The pattern for the group clause is group...by followed by an optional into, as shown in the following example:
string[] names = { "Bob", "Bill", "Jonetta", "Mary" };
var query = from name in names
group name by name[0];
or
var query2 = from name in names
group name by name[0] into g
//...additional query clauses
To correct this error
- Add the
bykeyword to thegroupclause.
Example
The following code generates CS0745:
// cs0745.cs
using System;
using System.Linq;
public class C
{
public static int Main()
{
string[] names = { "Bob", "Bill", "Jonetta", "Mary" };
var query = from name in names
group name name[0]; // CS0745
return 1;
}
}
See also
Tehke meiega GitHubis koostööd
Selle sisu allika leiate GitHubist, kus saate ka probleeme luua ja läbi vaadata ning päringuid teha. Lisateavet leiate meie kaasautorite juhendist.