Skip to content

Object Lifetime

Mario Gutierrez edited this page Jan 7, 2017 · 1 revision
  • Finalize() is called when an object is garbage collected.
    • In C# you define this like a C++ destructor ~MyClass() instead of overriding Finalize().
    • This is not usually implemented.
  • IDisposable defines the Dispose() method.
    • This is called manually by the client when finished to release resources.
  • Lazy<T> is a wrapper class that implements lazy initialization.
Clone this wiki locally