C# Error CS0744 – Expected contextual keyword ‘equals’

C# Error

CS0744 – Expected contextual keyword ‘equals’

Reason for the Error & Solution

Expected contextual keyword ‘equals’

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;  

To correct this error

  1. Add the equals keyword to the join clause.

Example

The following code generates CS0744:

// cs0744.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 on x y // CS0744  
                select x;  
        return 1;  
    }  
}  

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

This C# program calculates and displays an upper triangular matrix based on user input. Problem Statement: The program takes the...
This C# program serves as a demonstration of bitwise operators, which are fundamental operators used for manipulating individual bits in...
This C# program is designed to interchange or swap the columns of a matrix. A matrix is a two-dimensional array...