The latest version of C# allows for a simplified property declaration called auto implemented properties. With this feature, you can simply declare a property without having to declare a local, private field to back the property. Instead, the compiler will do this for you. This can be useful when you do not need logic inside the property’s accessors.

As an example, suppose you want a property on the Employee class called Name. You can declare this property without setting a private field variable as shown here:

public string Name { get; set; }

Notice that there is no logic in the get or set statements. Instead, the compiler will create an anonymous field to back the property for you. In addition, the IntelliSense built into the C# code editor makes this property declaration even faster. Simply type prop to stub out a code snippet based on the automatically implemented property syntax.

Source of Information : Sams Microsoft Visual Studio 2008 Unleashed


Subscribe to Developer Techno ?
Enter your email address:

Delivered by FeedBurner