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 convenience features like these add to the power developer's tool box. The downside is that the learning curve is increased a bit.

The first chapter (Chapter 20) is a 'must read' because properties are very commonly employed in C# applications. Tackle the remaining chapters of this part at your own pace.

The chapters in this part are:
 

¢ Chapter 20: C# properties

 

¢ Chapter 21: C# indexes

 

¢ Chapter 22: Operator overloading

 

¢ Chapter 23: User-defined conversions/casts.



From Java to C#. A Developers Guide
From Java to C#: A Developers Guide
ISBN: 0321136225
EAN: 2147483647
Year: 2003
Pages: 221
Authors: Heng Ngee Mok

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net