Conclusion

Conclusion

Types used in Visual C# applications fall into two categories: value types and reference types. Value types include the primitive types such as integers and other numeric types. Other types can be explicitly defined to be value types, such as the Rectangle and Point types found in the System.Drawing namespace. These value types typically have short lifetimes, and declaring them as value types improves efficiency by causing them to be allocated on the stack rather than on the managed heap.

Reference types are always allocated on the managed heap and are reclaimed by the garbage collector. Classes that need to be cleaned up immediately should implement the IDisposable interface to enable clients to use the using statement.

In Chapter 4, we’ll look at operators and type conversions. These features help make your types behave more like the primitive types built into the Visual C# language.



Part III: Programming Windows Forms