Skip to content

Add leftjoin/rightjoin syntax to linq to end the horrific syntax currently required #53236

@JohnGalt1717

Description

@JohnGalt1717

Background and Motivation

Right now doing left and right joins in linq is horrific and requires a ton of code that shouldn't be necessary if the proper language keywords were added.

Proposed API

Add leftjoin/right join syntax.

Usage Examples

from c in db.Contacts left join d in db.Domains on c.Id equals d.ContactId select new {c, d} //d would be nullable here.
from c in db.Contacts right join d in db.Domains on right c.Id equals d.ContactId select new {c, d} //c would be nullable here.

Of course you could easily write both as left joins so right could be dropped.

Alternative Designs

from c in db.Contacts leftjoin d in db.Domains on c.Id equals d.ContactId select new {c, d} //d would be nullable here.

Risks

Intellisense issues with left join right join because of multi word syntax maybe? Hence the second option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionEarly API idea and discussion, it is NOT ready for implementationarea-System.LinquntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions