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

Part 5: Convenience features

Introduction

Compared to Java, C# has several features that make things more convenient for the developer. Instead of accessor (getter) and mutator (setter) methods, we have C# properties. Besides being a cleaner and more elegant way of implementing getter and setter methods, public properties act and feel exactly like public fields to external parties - without the associated 'it-is-poor-programming-practice-to-make-your-fields-public' stigma.

C# also comes with indexes, operator overloading (a feature of C++ which Java dumped), and user-defined casting operations. These features are not really essential for an OO language and their functionality can be implemented using common methods. Nevertheless, additional ...

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