Compiler Error CS0743
Expected contextual keyword 'on'
The pattern for a join
clause is join
...in
...on
...equals
, as shown in this example:
var query = from x in array1
join y in array2 on x equals y
select x;
- Add the
on
keyword to thejoin
clause.
The following code generates CS0743:
// cs0743.cs
using System;
using System.Linq;
public class C
{
public static int Main()
{
int[] array1 = { 1, 2, 3, 4, 5, 6 };
int[] array2 = { 5, 6, 7, 8, 9 };
var c = from x in array1
join y in array2 x equals y // CS0743
select x;
return 1;
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: