C# Language Keywords in

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

The in keyword has three uses:

a) As part of the syntax in a foreach statement or as part of the syntax in a LINQ query

foreach (var member in sequence)
{
    // ...
}

b) In the context of generic interfaces and generic delegate types signifies contravariance for the type parameter in question:

public interface IComparer<in T>
{
    // ...
}

c) In the context of LINQ query refers to the collection that is being queried

var query = from x in source select new { x.Name, x.ID, };


Got any C# Language Question?