Summary

for RuBoard

This chapter explored several important interactions between C# and the .NET Framework, beginning with the root class object . We examined collections, including the methods of the object class that should be overridden to tap into the functionality provided by the .NET Framework. We introduced interfaces, which allow you to rigorously define a contract for a class to implement. While a class in C# can inherit from only one other class, it can implement multiple interfaces. Another benefit of interfaces is that they facilitate very dynamic programs. C# provides convenient facilities to query a class at runtime to see whether it supports a particular interface.

The interfaces supporting collections were examined in detail, and copy semantics were explored. While C++ relies on a language feature of a copy constructor, in C# you provide the capability by implementing a special interface, ICloneable . This led to an exploration of the role of generic interfaces in the .NET Framework programming model and to a comparison of the .NET and COM component models. A further illustration of programming with generic interfaces was provided by sorting in different orders with the IComparable interface. The examples offered insight into the workings of frameworks, which are more than class libraries. In a framework, you call the framework, and the framework calls you. Your code can be viewed as the middle layer of a sandwich. This key insight can help you grasp what makes .NET programming "tick."

This behavior of being called into has been around for a long time in the form of callback functions. The chapter included a careful examination of delegates and events. Two simple and intuitive examples were presented: a stock market simulation and an online chat room.

Finally, we covered attributes, which can be used to modify the behavior of entities of our program according to our specifications.

This chapter concludes our exploration of the C# programming language. In the next chapter we begin our detailed examination of the .NET Framework with a study of user interface programming using Windows Forms.

for RuBoard


Application Development Using C# and .NET
Application Development Using C# and .NET
ISBN: 013093383X
EAN: 2147483647
Year: 2001
Pages: 158

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