Automatic Properties in .NET 2.0 C# - Yes it is possible with a caveat

 Did you know that you can get automatic properties in .NET Framework 2.0?  

The key to doing so is to open a project in Visual Studio 2008. Make sure that the Target is .NET Framework 2.0 and that is  all it takes.

Even the snippets do not prompt you to create a backing private variable.

However a word of caution is that if you ever have a need to open this project in Visual studio 2005, it will not compile   and you should see the following error

" <VariableName>.get must declare a body because it is not marked abstract or extern" 

" <VariableName>.set must declare a body because it is not marked abstract or extern"  

 

No Comments