O'Reilly logo

Expert C# 5.0: with the .NET 4.5 Framework by Mohammad Rahman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 5

images

Automatic Property Declaration

This chapter will discuss automatic property declaration, which is a simplified syntax to declare a property for a class. I will also discuss the implicit variable declaration using the var keyword and show how var is handled by the C# compiler in design and runtime. Finally, I will discuss the anonymous type declaration and how the C# compiler compiles it.

Automatic Property

You can use the class of a real-world object to encapsulate its characteristics. For example, if you think about a real-life object, such as a book of class Book as demonstrated in Listing 5-1, you can see it has a name, a publication ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required