compilation problem in vc2005

  • Thread starter Thread starter Yoavo
  • Start date Start date
Y

Yoavo

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.
 
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
 
Back
Top