C# 8.0 - Can't use default interface implementations
Asked Answered
C

1

10

I recently read about C# 8.0 having interface default implementations, so i went into my project and tried it out, but i was met with an error instead. Target runtime doesn't support default interface implementation. Is there any way to fix this issue?

string CommandName { get => CommandName.ToUpperInvariant(); }

Edit I am using Console

Cohlier answered 7/12, 2019 at 12:39 Comment(0)
S
19

Did you check your runtime version? C# 8.0 is supported on .NET Core 3.x and .NET Standard 2.1.


UPDATE:

Thanks to Microsoft's confusing naming and versioning, the latest version of .NET SDK is called .NET x.x, but it's just like a new version of .NET Core--it's cross-platform and can target different runtimes.

C# 9.0 is the default language version since .NET 5.x (the latest version at the moment). You can check the default language version for different runtimes and how to configure the version here.

Spiller answered 7/12, 2019 at 13:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.