O'Reilly logo

From Java to C#: A Developer's Guide by Heng Ngee Mok

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 20. C# properties

C# properties are convenient alternatives to accessor (getter) and mutator (setter) methods in a class. It is something new and extremely useful. Do not confuse the term 'properties' in C# with the term 'properties' commonly used in OO nomenclature. Here, a property does not refer to a characteristic of a class, [1] although a C# property is still a class member.

[1] In OO literature, you will often see statements like 'a class contains properties, also known as attributes, which represent characteristics of a class'. properties and attributes in C# have different meanings. You use the term 'fields' or 'field variables' to represent the characteristics of a class.

What are called instance or static variables in Java, ...

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