O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Summary

In this chapter, you learned about object creation and, in particular, about constructors and their ability to perform useful actions when a new object is created. The chapter also looked at how memory, otherwise occupied by an object that no longer can be reached, is released with garbage collection, and how other scarce resources can be released with the Dispose design pattern.

The following paragraphs review the important points covered in this chapter.

An instance variable can be initialized in three different ways:

  • Automatically by the runtime. In which case, the instance variable is assigned a default value. The default value depends on the type of the instance variable.

  • Using a declaration initialization, which allows the programmer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required