Home > Software engineering >  How to use newer language features in an ASP.net website?
How to use newer language features in an ASP.net website?

Time:01-29

I'm trying to use a local function in my asp.net web-site:

public class Handler : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        Int32 Seven()
        {
            return 7;
        }
    }
}

But i get an compile-time error:

CS8026 Feature 'local functions' is not available in C# 5. Please use language version 7.0 or greater.

Ok then.

How to use Language Version 7.0 or greater in an ASP.net web-site?

It seems everyone knows how to upgrade an ASP.net web-application to a newer version of C#. But how to you upgrade an ASP.net web-site to a newer version of C#?

One person suggests -

CodePudding user response:

Changing the Target Framework to 4.8 should get you C# 7.3 features. C# features are standardized and correspond with the framework version.

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version

  •  Tags:  
  • Related