I am currently using .NET Core 3, Preview 4, and Visual Studio 2019, Version 16.0.2.

Here are the contents of my .csproj file for my .NET Core project:

<Project Sdk="Microsoft.NET.Sdk">



As an experiment, I copied some code taken from this page into my project:

public static string RockPaperScissors(string first, string second)
=> (first, second) switch
    ("rock", "paper") => "rock is covered by paper. Paper wins.",
    ("rock", "scissors") => "rock breaks scissors. Rock wins.",
    ("paper", "rock") => "paper covers rock. Paper wins.",
    ("paper", "scissors") => "paper is cut by scissors. Scissors wins.",
    ("scissors", "rock") => "scissors is broken by rock. Rock wins.",
    ("scissors", "paper") => "scissors cuts paper. Scissors wins.",
    (_, _) => "tie"

However, it won't compile:

enter image description here

As you can see, the compiler displays the error message "Unexpected token".

What should I do to be able to use C# 8 language features in my .NET Core project?

1 Answers

MY_G On Best Solutions

I disabled ReSharper, and the problem disappeared.