c#-必须声明主体,因为它没有标记为abstract或extern(CS0501)
作者:互联网
这个问题已经在这里有了答案: > must declare a body because it is not marked abstract or extern? C#/ASP.NET 3个
我是C#的新手,不知道其语法.但是我对其他语言(Java,C)有所了解.
我下载了GLWidget project并尝试进行构建.但是我在这些行(用{get; set;})上得到了一个CS0501错误:
namespace Gtk
{
[ToolboxItem(true)]
public class GLWidget : DrawingArea, IDisposable
{
IGraphicsContext graphicsContext;
static int graphicsContextCount;
/// <summary>Use a single buffer versus a double buffer.</summary>
[Browsable(true)]
public bool SingleBuffer { get; set; }
/// <summary>Color Buffer Bits-Per-Pixel</summary>
public int ColorBPP { get; set; }
/// <summary>Accumulation Buffer Bits-Per-Pixel</summary>
public int AccumulatorBPP { get; set; }
/// <summary>Depth Buffer Bits-Per-Pixel</summary>
public int DepthBPP { get; set; }
/// <summary>Stencil Buffer Bits-Per-Pixel</summary>
public int StencilBPP { get; set; }
/// <summary>Number of samples</summary>
public int Samples { get; set; }
/// <summary>Indicates if steropic renderering is enabled</summary>
public bool Stereo { get; set; }
IWindowInfo windowInfo;
为什么这个人这样做?这是一个小错误吗?
解决方法:
您正在使用哪个版本的编译器?这段代码使用的是C7000 3.0和更高版本中提供的Auto-Implemented Properties.
由于我假设MonoDevelop使用Mono compiler‘mcs'(及其变体),因此此问题取决于Mono的版本. Mono 2.6支持C#3.0(和4.0预览版).也许您只需要升级Mono和/或MonoDevelop.
标签:automatic-properties,compiler-errors,c 来源: https://codeday.me/bug/20191101/1986855.html