Question

Im newbie in C# and don't know its syntax. But I know a bit about other languages (Java, C++). I downloaded GLWidget project and tryed to build it. However I got an error CS0501 at these lines (with { get; set; }):

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;

Why did this guy do that? Is it a trivial error or not?

Was it helpful?

Solution

What version of the compiler are you using? This code is using Auto-Implemented Properties which are available in C# 3.0 and later.

Since I'm assuming MonoDevelop uses the Mono compiler 'mcs' (and varients), this problem depends on the version of Mono. Mono 2.6 has support for C# 3.0 (and a preview of 4.0). Perhaps you just need to upgrade Mono and/or MonoDevelop.

OTHER TIPS

Automatic properties was introduced in c# 3.0, so try to change framework version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top