How to fix this?

BenTam 1,801 Reputation points
2024-03-24T08:45:29.0066667+00:00

Hello everyone,


CS8370 Feature 'static local functions' is not available in C# 7.3. Please use language version 8.0 or greater.


    Can someone please guide me on how to fix this issue?

Errors

  • I believe my Visual Studio can run C# 8.0 or 9.0. I'd like to know how to force my system to use C# 8.0 or 9.0.
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

Answer accepted by question author
  1. Karen Payne MVP 35,596 Reputation points Volunteer Moderator
    2024-03-24T11:31:31.47+00:00

    Try the following.

    public static class Extensions
    {
        public static T IIf<T>(this bool expression, T truePart, T falsePart) 
            => expression ? truePart : falsePart;
    }
    
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.