Summary


In this chapter, we've seen how to define scalar properties; we've discussed the tradeoff between properties, fields, and methods. We then saw how to define read/write, read-only, and write-only properties. We discussed guidelines and best practices for each of these techniques along the way. Indexers allow types to be represented as arrays.

Operators are symbols and characters used to perform operations on one or more types. They can be overloaded to encapsulate complex expressions. We also discussed how operator overloading works in C# and how it eases the readability of our code. We discussed the best practices of operator overloading and we saw how operators can be overloaded in a class as well as in a structure. We also discussed overloading the == and != operators to override the reference equality behavior in reference types. In the next chapter, we will discuss Constructors and their role in designing classes in C#.




C# Class Design Handbook(c) Coding Effective Classes
C# Class Design Handbook: Coding Effective Classes
ISBN: 1590592573
EAN: 2147483647
Year: N/A
Pages: 90

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