Skip to content

c# 8.0 'var' pattern matching not presented #17067

Closed

Description

@CodeIsLie

Hi, i don't see reference to new pattern matching presented in latest version of C#:
for example:

state = (state, transition) switch
{
(State.Running, Transition.Suspend) => State.Suspended,
(State.Suspended, Transition.Resume) => State.Running,
(State.Suspended, Transition.Terminate) => State.NotRunning,
(State.NotRunning, Transition.Activate) => State.Running,
_ => throw new InvalidOperationException()
};

and some other examples with this syntax would be very helpful on this page


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. added
    help wanted
    and removed
    ⌚ Not Triaged
    on Feb 13, 2020
  2. BillWagner commented on Feb 13, 2020

    @BillWagner
    Member

    Thanks for writing this @CodeIsLie

    There are a few examples like this in this tutorial The best plan is to add a link to that article here.

    I've added the "up for grabs" label for any community members to make this addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dotnet-csharp/svchelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions