Summary


In this chapter, you have covered many of the techniques that you can use to make your OOP applications far more powerful — and more interesting. Although these techniques take a little effort to accomplish, they can make your classes much easier to work with and, therefore, simplify the task of writing the rest of the code.

Each of the topics covered has many uses. You're likely to come across collections of one form or another in almost any application, and creating strongly typed collections can make your life much easier if you need to work with a group of objects of the same type. You also saw how you can add indexers and iterators to get easy access to objects within the collection.

Comparisons and conversions are another area that will crop up time and again. You saw how various comparisons can be performed, as well as some of the underlying functionality with boxing and unboxing. You also saw how to overload operators for both comparisons and conversions, and how to link things together with list sorting.

In this chapter, you looked at:

  • Collections

    • Using collections

    • Indexers

    • Iterators

  • Comparisons

    • Type comparison

    • Value comparison

  • Conversions

In the next chapter, you'll be looking at something entirely new — generics. They allow you to create classes that automatically customize themselves to work with dynamically chosen types. This is especially useful when it comes to collections, and you'll see how much of the code in this chapter can be simplified dramatically using generic collections.




Beginning Visual C# 2005
Beginning Visual C#supAND#174;/sup 2005
ISBN: B000N7ETVG
EAN: N/A
Year: 2005
Pages: 278

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