Sushil Jadhav
Sushil Jadhav

Reputation: 2295

Error "; expected" lambda expression

When I build the project I am getting error:

; expected

at below line (at => symbol). I google the issue but did not found anything.

public sealed class SqlError : baseclass
{
    public override string Name => "sql";`  --> Error here

Name property in base class is defined as below

public virtual string Name { get; }

Upvotes: 2

Views: 6300

Answers (2)

Andy Lamb
Andy Lamb

Reputation: 2221

It's a C# 6.0 feature which I don't think can be used in VS2013. Stick to a normal property override. It's available in VS2015 if the project has been configured to support C# 6.0.

Upvotes: 3

Just turn it into

public override string Name{
    get{
      return "sql;
    }
}

I think its a VS2015 feature

public override string Name => "sql";` 

is the ' in the code aswell, then remove it ?

Upvotes: 2

Related Questions