.NET property generating “must declare a body because it is not marked abstract or extern” compilation error

后端 未结 9 1380
离开以前
离开以前 2021-02-13 20:03

I have a .NET 3.5 (target framework) web application. I have some code that looks like this:

public string LogPath { get; private set; }
public string ErrorMsg          


        
9条回答
  •  误落风尘
    2021-02-13 20:33

    The syntax is valid. And you can set different access modifiers. You aren't on an Interface are you? And the class these are in isn't abstract is it?

    Also, doesn't matter what v. of the framework you target because this is a compiler feature. VS2008 will implement the property w/ backing stores for you.

提交回复
热议问题