compilation problem in vc2005

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Yoavo

    #1

    compilation problem in vc2005

    Hi,
    I have the following code:

    class AA
    {
    public int Width { get; set; }
    }

    this compiles ok on VC2008 but fails in VC2005.
    What is the reason and how can I build it ok in VC2005 ?

    Yoav.


  • Jon Skeet [C# MVP]

    #2
    Re: compilation problem in vc2005

    On Sep 23, 9:59 am, "Yoavo" <y...@cimatron. co.ilwrote:
    I have the following code:
    >
    class AA
    {
        public int Width { get; set; }
    }
    >
    this compiles ok on VC2008 but fails in VC2005.
    What is the reason and how can I build it ok in VC2005 ?
    That's an automatically implemented property, which is part of C# 3.0.
    Visual Studio 2005 only supports C# 2.0. If you *have* to use VS2005,
    you'll need to write the equivalent C# 2.0 code:

    class AA
    {
    private int width;
    public int Width
    {
    get { return width; }
    set { width = value; }
    }
    }

    Jon

    Comment

    Working...