<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Generalities &amp; Details: Adventures in the High-tech Underbelly</title>
    <link>http://www.bluebytesoftware.com/blog/</link>
    <description>Joe Duffy's Weblog</description>
    <language>en-us</language>
    <copyright>Joe Duffy</copyright>
    <lastBuildDate>Fri, 08 Apr 2005 22:17:01 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.8.5223.2</generator>
    <managingEditor>joe@bluebytesoftware.com</managingEditor>
    <webMaster>joe@bluebytesoftware.com</webMaster>
    <item>
      <trackback:ping>http://www.bluebytesoftware.com/blog/Trackback.aspx?guid=88e62cdf-5919-4ac7-bc33-20c06ae539ae</trackback:ping>
      <pingback:server>http://www.bluebytesoftware.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.bluebytesoftware.com/blog/PermaLink,guid,88e62cdf-5919-4ac7-bc33-20c06ae539ae.aspx</pingback:target>
      <dc:creator>
      </dc:creator>
      <title>DG Update: Dispose, Finalization, and Resource Management</title>
      <guid>http://www.bluebytesoftware.com/blog/PermaLink,guid,88e62cdf-5919-4ac7-bc33-20c06ae539ae.aspx</guid>
      <link>http://www.bluebytesoftware.com/blog/2005/04/08/DGUpdateDisposeFinalizationAndResourceManagement.aspx</link>
      <pubDate>Fri, 08 Apr 2005 22:17:01 GMT</pubDate>
      <description>&lt;p&gt;
   Alright! Here it is: the revised &amp;#8220;Dispose, Finalization, and Resource Management&amp;#8221;
   Design Guideline entry. I mentioned this work previously&amp;nbsp;&lt;a href="http://www.bluebytesoftware.com/blog/PermaLink.aspx?guid=1fe0f820-5b2b-4b17-82af-08142e7f308a"&gt;here&lt;/a&gt; and &lt;a href="http://www.bluebytesoftware.com/blog/PermaLink.aspx?guid=69041542-cd48-4d47-9499-a88aa3737081"&gt;here&lt;/a&gt;.
   At ~25 printed pages, it's not what I would consider to be a minor update. Took me
   much longer than anticipated, but I'm happy with the result.&amp;nbsp;I got to work with
   and received good amounts of feedback from &lt;a href="http://www.pluralsight.com/blogs/hsutter/default.aspx"&gt;HSutter&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/bclteam/"&gt;BrianGru&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/cbrumme/"&gt;CBrumme&lt;/a&gt;, &lt;a href="http://www.wintellect.com/weblogs/wintellect/"&gt;Jeff
   Richter&lt;/a&gt;, and a couple other folks on it... Good fun.
&lt;/p&gt;
&lt;p&gt;
   As usual,&amp;nbsp;questions, comments, and feedback are requested.&amp;nbsp;Hope it comes
   across formatted half-decently.
&lt;/p&gt;
&lt;p&gt;
   &lt;em&gt;Update: 4/16/05: Fixed a few typos that were bugging me &amp;amp; came up during the
   internal review of this doc.&lt;/em&gt;
&lt;/p&gt;
&lt;h2 style="MARGIN: 12pt 0in 6pt 0.4in"&gt;&lt;a name=_Toc98745874&gt;&lt;font color=#808080&gt;&lt;span lang=ES style="mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana"&gt;&lt;span style="mso-list: Ignore"&gt;1.1 &lt;/span&gt;&lt;/span&gt;&lt;span lang=ES&gt;Dispose,
   Finalization, and Resource Management&lt;/span&gt;&lt;/font&gt;&lt;/a&gt;&lt;span lang=ES&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/h2&gt;
&lt;font color=#000000&gt; 
&lt;p class=text style="MARGIN: 3pt 0in"&gt;
   The CLR&amp;#8217;s garbage collector (GC) does an amazing job at managing memory allocated
   directly to CLR objects, but was explicitly not designed to deal with unmanaged memory
   and OS-managed resources. In many cases, objects running inside the CLR need to interact
   with resources from the unmanaged world. There&amp;#8217;s a considerable gap between
   these two worlds, requiring a bridge to explicitly manage the touch points. The responsibility
   for building such a bridge lies mostly in the hands of managed API developers.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=text0 style="MARGIN: 3pt 0in"&gt;
&lt;/font&gt;&lt;font color=#000000&gt;The primary goal when managing such resources is quite
simply to make use of them in the most efficient manner. This is especially important
when resources are limited, e.g. when only a limited quantity is available. You should
strive to provide your users with the controls needed to acquire and release resources
as needed, in addition to ensuring a safety net exists to prevent long-running resource
leaks. Thankfully, the .NET Framework comes with an array of abstractions to hide
the details of unmanaged resources from most platform developers (e.g. with HWnds,
database connections, GDI handles, SafeHandle), but the sheer number of resource types
available means that you&amp;#8217;ll sometimes need to write code to manage them yourself.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&gt;
&lt;p class=text0 style="MARGIN: 3pt 0in"&gt;
   &lt;font color=#000000&gt;This section documents the recommended pattern for implementing
   both explicit and implicit resource cleanup. This is often referred to as the &amp;#8220;Dispose&amp;#8221;
   or &amp;#8220;IDisposable&amp;#8221; pattern, and normally involves the IDisposable interface,
   a Dispose method for explicit cleanup, and in some cases a Finalize method for implicit
   cleanup. Implementing this pattern correctly&amp;#8212;when appropriate&amp;#8212;is critical
   to ensuring proper, timely cleanup of resources, and also to provide users with a
   deterministic, familiar way of disposing of resources.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;&lt;?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /&gt;Annotation
      (&lt;st1:PersonName w:st="on"&gt;Krzysztof Cwalina&lt;/st1:PersonName&gt;
      ): Many people who hear about the Dispose pattern for the first time complain that
      the GC isn&amp;#8217;t doing its job. They think it should collect resources, and that
      this is just like having to manage resources as you did in the unmanaged world. The
      truth is that the GC was never meant to manage resources. It was designed to manage
      memory and it is excellent in doing just that.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;h3 style="MARGIN: 16pt 0in 6pt 0.5in"&gt;&lt;a name=_Toc98745875&gt;&lt;font size=5&gt;&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana"&gt;&lt;span style="mso-list: Ignore"&gt;1.1.1 &lt;/span&gt;&lt;/span&gt;Overview&lt;/font&gt;&lt;/font&gt;&lt;/a&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
&lt;/h3&gt;
&lt;font color=#000000&gt; 
&lt;p class=text style="MARGIN: 3pt 0in"&gt;
   Managed types must occasionally encapsulate control over resources that are not managed
   by the CLR. In such cases, the smallest possible class, or &amp;#8220;wrapper,&amp;#8221;
   should be used to encapsulate these resources. Ideally, this thin wrapper should contain
   just allocation along with provisions for basic access to and freeing of the resources.
   Enclosing classes can be used to provide a more natural view over the resource through
   abstracted APIs, taking care not to expose the internal resource wrapper. Following
   this pattern helps to mitigate many of the risks and difficulties outlined further
   in this section.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=text0 style="MARGIN: 3pt 0in"&gt;
&lt;/font&gt;&lt;font color=#000000&gt;An explicit Dispose method should always be provided to
enable users to free resources owned by an instance deterministically. Implicit cleanup
by means of a Finalize method is also required when a class directly owns such a resource,
but often the resource wrapping class&amp;#8212;such as SafeHandle for example&amp;#8212;will
take care of this for you. This leaves only the task of creating an explicit cleanup
mechanism to the Framework developer. We discuss both implicit and explicit cleanup
in the next section.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt"&gt;
   &lt;b&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Implicit Cleanup&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=text0 style="MARGIN: 3pt 0in"&gt;
   &lt;font color=#000000&gt;Implicit cleanup should always be provided by protecting resources
   with a SafeHandle. In fact, implementing finalizers by hand is seldom necessary thanks
   to the introduction of this type in the .NET Framework 2.0. If supplementary finalization
   semantics are required, you can implement the protected Finalize&lt;b&gt; &lt;/b&gt;method yourself
   using the special finalizer syntax in your favorite language (e.g. ~T() in C# and
   !T() in C++). The runtime will invoke Finalize for you nondeterministically as part
   of the GC&amp;#8217;s finalization process, providing a last chance for your object to
   ensure resources are released at the end of its lifetime. By nondeterministic, this
   simply means that the GC will call Finalize at an undefined point in time after there
   are no longer any live references to your object. Correctly implementing finalizers
   by hand is a notoriously difficult task&amp;#8212;please see details further below should
   you decide you have to do so.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt"&gt;
   &lt;b&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Explicit Cleanup&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=text0 style="MARGIN: 3pt 0in"&gt;
   &lt;font color=#000000&gt;In every case where a type owns resources&amp;#8212;or owns types
   which themselves own resources&amp;#8212;you should give users the ability to explicitly
   release these them. Developers will then have the option to initiate the release of
   resources once the object is no longer in use. This alleviates some of the reliance
   on the GC for destruction of resources (something which can subtly harm performance),
   and also provides users a deterministic way to reclaim resources. Moreover, if the
   external resource is scarce or expensive, as is the case with OS-allocated handles
   (e.g. file handles), performance can be improved and resource starvation avoided if
   they are released once no longer needed. Explicit control should always be provided
   with a Dispose method based on the IDisposable interface (in C++, simply write a destructor,
   ~T(), for your type T; the compiler will generate the entire underlying Dispose mechanics).&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=text0 style="MARGIN: 3pt 0in"&gt;
   &lt;font color=#000000&gt;Read below for more information on the general pattern, as it
   actually involves more than simply writing a Dispose method when creating a non-sealed
   class.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (Clemens Szyperski): The only problem
      is that automatic management of memory and objects makes it difficult to ensure that
      resources held by objects are released deterministically (that is, early). The reliance
      on the GC can lead programmers to think that they don't need to worry about this anymore,
      which is not the case. In fact, any object that implements IDisposable should be mentally
      tagged with a red flag and should not be allowed to fall off the scene without Dispose
      having been called. The finalization/safe handle safety net is really not good enough
      to prevent lousy user experiences - such as a file remaining locked for an unexpectedly
      long time after "save" and "close" of a document window (but with the app still running).
      Careful use of AppDomains and their forced unloading (which triggers safe handles)
      is sometimes a way to deal with this rigorously.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=text0 style="MARGIN: 3pt 0in"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=AnnotationCxSpFirst style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (Herb Sutter): Finalizers are actually
      even worse than that. Besides that they run late (which is indeed a serious problem
      for many kinds of resources), they are also less powerful because they can only perform
      a subset of the operations allowed in a destructor (e.g., a finalizer cannot reliably
      use other objects, whereas a destructor can), and even when writing in that subset
      finalizers are extremely difficult to write correctly. And collecting finalizable
      objects is expensive: Each finalizable object, and the potentially huge graph of objects
      reachable from it, is promoted to the next GC generation, which makes it more expense
      to collect by some large multiple.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpLast style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 6pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Today, on most GC systems including .NET, the
      right advice is: When you have to do cleanup for your object, you almost always want
      to provide it in a destructor (Dispose), &lt;i style="mso-bidi-font-style: normal"&gt;not&lt;/i&gt; in
      a finalizer. When you do want a finalizer, you want it in addition to a destructor
      (Dispose), &lt;i style="mso-bidi-font-style: normal"&gt;not&lt;/i&gt; instead of Dispose.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=AnnotationCxSpFirst style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Brian Grunkemeyer&lt;/st1:PersonName&gt;
      ): There are two different concepts that are somewhat intertwined around object tear-down.
      The first is the end of the lifetime of a resource (such as a Win32 file handle),
      and the second is the end of the lifetime of the object holding the resource (such
      as an instance of FileStream). Unmanaged C++ provided destructors which ran deterministically
      when an object left scope, or when the programmer called delete on a pointer to an
      object.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;This would end the resource&amp;#8217;s
      lifetime, and at least in the case of delete, end the lifetime of the object holding
      onto the resource. The CLR&amp;#8217;s finalization support only allows you to run code
      at the end of the lifetime of the object holding a resource. Relying on finalization
      as the sole mechanism for cleaning up resources extends the resource&amp;#8217;s lifetime
      to be equal to the lifetime of the object holding the resource, which can lead to
      problems if you need exclusive access to that resource or there are a finite number
      of them, and can hurt performance. Hence, witness the Dispose pattern for managed
      code, allowing you to define a method to explicitly mimic the determinism &amp;amp; eagerness
      of destructors in C++. This relegates finalization to a backstop against users of
      a type who do not call Dispose, which is a good thing considering the additional restrictions
      on finalizers.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;o:p&gt;
         &lt;font face=Arial color=#000080&gt;&amp;nbsp;&lt;/font&gt;
      &lt;/o:p&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpLast style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 6pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Now that you understand this, note that the Finalize
      &amp;amp; Dispose methods serve very different purposes. Unfortunately, they&amp;#8217;re
      surfaced differently in different languages. C# calls a finalizer a destructor, forcing
      you to use ~T(), whereas Dispose is a normal method. In C++ starting with version
      2 of the .NET Framework, Dispose methods are generated from code written using the
      destructor syntax (~T), whereas the finalizer will be specified using some other syntax
      like !T(). C# arguably emphasized the wrong aspect of object lifetime (instead of
      resource lifetime) by giving the special C++ name the wrong meaning. But note that
      when you see the word destructor or ~T() in any discussion on Dispose() or object
      lifetime, pay attention to exactly what the author intended. I prefer using &amp;#8220;finalizer&amp;#8221;
      and &amp;#8220;dispose&amp;#8221; to alleviate any language-induced confusion. Note that this
      pattern also calls for Dispose(void) &amp;amp; Dispose(bool) in places.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Generally speaking, it is considered
   good design for consumers of a disposable instance to call Dispose when they are done
   using it. This is simpler in languages like C# which provides a &amp;#8220;using&amp;#8221;
   block to automate calling Dispose for local objects, and in languages like C++ which
   fully automate &amp;#8220;using&amp;#8221; with stack-based semantics. However, implicit cleanup
   is still necessary for cases where a user neglects or fails to invoke the explicit
   release mechanism, essentially transferring responsibility to the runtime to perform
   the cleanup.&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;h3 style="MARGIN: 16pt 0in 6pt 0.5in"&gt;&lt;a name=_Toc98745876&gt;&lt;font size=5&gt;&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana"&gt;&lt;span style="mso-list: Ignore"&gt;1.1.2 &lt;/span&gt;&lt;/span&gt;Dispose
   Pattern&lt;/font&gt;&lt;/font&gt;&lt;/a&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
&lt;/h3&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;If your class is not sealed
   and has to perform resource cleanup, you should follow the pattern exactly as it appears
   below. For sealed classes, this pattern need not be followed, meaning you should simply
   implement your Finalizer and Dispose with the simple methods (i.e. ~T() (Finalize)
   and Dispose() in C#). When choosing the latter route, your code should still adhere
   to the guidelines below regarding implementation of finalization and dispose logic.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;This pattern has been designed
   to ensure reliable, predictable cleanup, to prevent temporary resource leaks (as a
   result of skipped disposes, for example), and most importantly to provide a standard,
   unambiguous pattern for compilers and developers to author disposable classes and
   for programmers consuming disposable instances. The description below also offers
   guidance on when and why you should implement a finalizer, as not every disposable
   type needs one. Lastly, versioning classes that require resource cleanup poses some
   challenges, especially when introducing a new type into an existing class hierarchy.
   This is also discussed below.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (Herb Sutter): You really don&amp;#8217;t
      want to write a finalizer if you can help it. Besides problems already noted earlier
      in this chapter, writing a finalizer on a type makes that type more expensive to use &lt;/font&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;even
      if the finalizer is never called. For example, allocating a finalizable object is
      more expensive because it must also be put on a list of finalizable objects. This
      cost can&amp;#8217;t be avoided, even if the object immediately suppresses finalization
      during its construction (as when creating a managed object semantically on the stack
      in C++).&lt;/span&gt;
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;If using C++, simply write
   the usual destructor (~T()) and the compiler will automatically generate all of the
   machinery described later in this section. In the rare cases where you do want to
   write a finalizer (!T()) as well, the recommended way to share code is to put as much
   of the work into the finalizer as the finalizer is able to handle (e.g., the finalizer
   cannot reliably touch other objects, so don&amp;#8217;t put code in there that needs to
   use other objects), put the rest in the destructor, and have your destructor call
   your finalizer explicitly.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; implement
   the dispose pattern when your type is unsealed and contains resources that explicitly
   need to be or can be freed, for example raw handles, or other unmanaged resources.
   This pattern provides a standardized means for developers to deterministically destroy
   or free resources owned by an object. It also aids subclasses to correctly release
   base class resources.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; fully
   implement the dispose pattern on classes with disposable subtypes, even if the base
   type does not own resources. This will enable programmers coding against the base
   class to dispose of further derived instances properly. A great example of this pattern
   is the v2.0 System.IO.Stream class. Although it is an abstract base class which doesn&amp;#8217;t
   hold on to resources, most of its subclasses do; because of this, it follows this
   pattern.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; implement
   IDisposable only on classes where a class in its parent hierarchy has not already
   done so. The public void Dispose() method should be left final (i.e. not marked virtual)
   and consist of only two operations: a virtual call to Dispose(true) and a call to
   GC.SuppressFinalize(this), in that order. The call to SuppressFinalize should only
   occur if Dispose(true) executes successfully&amp;#8212;thus, you should not place the
   call inside a finally block. Types inheriting from other classes which already follow
   this pattern can and should reuse the existing implementation of Dispose().&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Brad Abrams&lt;/st1:PersonName&gt;
      ):&amp;nbsp; We had a fair amount of debate about the relative ordering of calls in the
      Dispose() method. E.g.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCodeCxSpFirst style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Dispose()&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCodeCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCodeCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dispose(true);&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCodeCxSpLast style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 6pt; mso-add-space: auto"&gt;
      &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
      GC&lt;/b&gt;.SuppressFinalize(this);&lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Or&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCodeCxSpFirst style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Dispose()&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCodeCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCodeCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
      GC&lt;/b&gt;.SuppressFinalize(this);&lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dispose(true);&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCodeCxSpLast style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 6pt; mso-add-space: auto"&gt;
      &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;We opted for the first ordering as it ensures
      that GC.SuppressFinalize() only gets called if the Dispose operation completes successfully.&amp;nbsp; 
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;o:p&gt;
      &lt;font face=Tahoma color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Jeffrey Richter&lt;/st1:PersonName&gt;
      ): I too wrestled back and forth with the order of these calls. Originally, I felt
      that SuppressFinalize should be called prior to Dispose. My thinking was this: if
      Dispose throws an exception then, it will throw the same exception when Finalize is
      called and there is no benefit this and the 2nd exception should be prevented. However,
      I have since changed my mind and I now agree with this guideline that SuppressFinalize
      should be called after Finalize. The reason is because Dispose() calls Dispose(true)
      which may throw but when Finalize is called later Dispose(false) is called and this
      may be a different code path than before and it would be good if this different code
      path executed. And, the different code path may not throw the exception.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;o:p&gt;
      &lt;font face=Tahoma color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Brian Grunkemeyer&lt;/st1:PersonName&gt;
      ): The ordering is important to give your finalization code (in Dispose(false)) a
      chance to clean up the resource even if some higher level guarantees usually made
      when disposing the object can&amp;#8217;t be made.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;A
      Dispose method should be able to guarantee correctness &amp;amp; free the resource when
      it completes.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;But if the code for guaranteeing
      correctness fails, we fall back on the finalizer, which calls Dispose(false).&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;This
      may entail some amount of corruption or data loss, but at that point the corruption
      is inevitable, and at least we can ensure we don&amp;#8217;t have a resource leak.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Finalization
      code already has to deal with partially constructed objects, so the additional burden
      of dealing with an object where the Dispose(true) code path failed shouldn&amp;#8217;t
      be significant.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; create
   or override the protected virtual void Dispose(bool disposing) method to encapsulate
   all of your cleanup logic. All cleanup should occur in this method, predicated&amp;#8212;if
   necessary&amp;#8212;by the disposing argument. The argument&amp;#8217;s value will equal false
   if being invoked from inside a finalizer, which should be used to ensure any code
   running from a finalizer is careful to follow the Finalize guidelines detailed in
   the next section.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Jeffrey Richter&lt;/st1:PersonName&gt;
      ): The idea here is that Dispose(Boolean) knows whether it is being called to do explicit
      cleanup (the Boolean is true) versus being called due to a garbage collection (the
      Boolean is false). This distinction is useful because, when being disposed explicitly,
      the Dispose(Boolean) method can safely execute code using reference type fields that
      refer to other objects knowing for sure that these other objects have not been finalized
      or disposed of yet. When the Boolean is false, the Dispose(Boolean) method should
      not execute code that refer to reference type fields because those objects may have
      already been finalized.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in; TEXT-INDENT: 0in; mso-list: none; tab-stops: .25in"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (Joe Duffy): Jeff&amp;#8217;s comment
      might seem to be an overstatement under careful examination. For example, can&amp;#8217;t
      you safely access reference type objects that aren&amp;#8217;t finalizable? The answer
      is yes you can, &lt;i style="mso-bidi-font-style: normal"&gt;iff&lt;/i&gt; you are certain that
      it doesn&amp;#8217;t rely on finalizable state itself. This&amp;nbsp;reliance could be&amp;nbsp;directly
      or indirectly through complex relationships with other reference types--a pretty nontrivial
      thing to figure out (and something which is subject to change from release to release).
      So unless you&amp;#8217;re 100% certain, just avoid doing it.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; make
   a call to your base class&amp;#8217;s Dispose(bool disposing) method (if available) as
   the last operation in your Dispose(bool) implementation. Make sure to preserve the
   value of the disposing argument by passing the same value that your method received.
   This makes sure that base classes are given a chance to clean up of resources, but
   not before your cleanup code executes (which could rely on their presence).&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; implement
   a finalizer if your object is responsible for controlling the lifetime of at least
   one resource which does not have its own finalizer. Types like SafeHandle, for example,
   have their own finalizers responsible for cleaning up resources. In other cases, however,
   users will often neglect to write code which guarantees executing explicit dispose
   logic. If your base class has already overridden Finalize to follow this pattern,
   you should not override it yourself, as it will make the call to your virtual Dispose(bool)
   override appropriately.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;When implementing your finalizer,
   place all finalization cleanup logic inside the Dispose(bool disposing) method. Your
   Finalize method should make a single virtual call to Dispose(false) and nothing more.
   As noted above, any logic not appropriate to execute during finalization should be
   written so as not to fire if the disposing argument is false. Such restrictions are
   discussed further below.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; re-implement the IDisposable interface, override void Dispose(), or override
   Finalize if a base type in your class hierarchy has already defined them according
   to this pattern. You should just override Dispose(bool) and add your cleanup logic,
   making sure to call upwards to your base class. Re-implementing Finalize can actually
   result in unnecessary calls to Dispose(bool).&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Joe Duffy&lt;/st1:PersonName&gt;
      ): Having multiple finalizers in a class hierarchy which follows this pattern can
      result in redundant calls to perform cleanup logic. A virtual finalize method that
      automatically chains to base.Finalize()&amp;#8212;precisely what the C# compiler creates
      by default&amp;#8212;will make n virtual calls Dispose(bool), where n is the number of
      finalizers the hierarchy following this pattern. This happens because Finalize is
      called virtually which in turn virtually calls Dispose(bool), both of which chain
      to their base classes. So long as types are written to be resilient to multiple disposes
      (ignoring unnecessary calls), the only problem this will create is the subtle performance
      overhead to make the redundant chains of virtual method calls.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (Herb Sutter): Note that what Joe
      mentions about C# doesn&amp;#8217;t happen in C++, because C++ generates the recommended
      machinery whereby Dispose(bool) in the only point that chains to the base (disposer
      or finalizer)&lt;/font&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;.&lt;/span&gt;
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; create any other variations of the Dispose method other than the two specified
   here: void Dispose() and void Dispose(bool disposing). Dispose should be considered
   a reserved word in order to help codify this pattern and prevent confusion among implementers,
   users, and compilers. Some languages (like C++) may choose to automatically implement
   this pattern on certain types, such as taking methods like ~T() and !T(), and folding
   them into one Dispose(bool) method. 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt"&gt;
   &lt;b&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Simple Example w/out Finalize
   (C#)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;For the majority of types implementing
   the Dispose pattern, you will not need to implement your own Finalize method. This
   example shows the simple case, for example when using a SafeHandle to take care of
   the implicit cleanup:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class SimpleCleanup : IDisposable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // some fields that
   require cleanup&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   SafeHandle handle;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   bool disposed = false; // to detect redundant calls&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   SimpleCleanup()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;this.handle
   = /*&amp;#8230;*/;&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;protected
   virtual void Dispose(bool disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   if (!disposed)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;
   if (disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;
   {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   if (handle != null)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;handle.Dispose();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;disposed
   = true;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Dispose()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   Dispose(true);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font face="Courier New"&gt;&lt;font color=#000000&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font face="Courier New"&gt;&lt;font color=#000000&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt"&gt;
   &lt;b&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt"&gt;
   &lt;b&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Complex Example w/ Finalize
   (C#)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Consider this example of the
   shell of a correct base-type implementation of the more complex pattern. That is,
   an implementation that has its own Finalizer. This also demonstrates what a class
   newly introducing cleanup into a class hierarchy should look like:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class ComplexCleanupBase : IDisposable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // some fields that
   require cleanup&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   bool disposed = false; // to detect redundant calls&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   ComplexCleanupBase()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   allocate resources&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;protected
   virtual void Dispose(bool disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   if (!disposed)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;
   if (disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;
   {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   // dispose-only, i.e. non-finalizable logic&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   shared cleanup logic&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;disposed
   = true;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~ComplexCleanupBase()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   Dispose(false);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Dispose()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   Dispose(true);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;GC.SuppressFinalize(this);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;This code snippet shows what
   a class extending ComplexCleanupBase would do to hook into the Dispose and Finalize
   lifecycle to ensure correct cleanup behavior:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class ComplexCleanupExtender :
   ComplexCleanupBase&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // some new fields
   that require cleanup&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   bool disposed = false; // to detect redundant calls&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   ComplexCleanupExtender() : base()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   allocate more resources (in addition to base&amp;#8217;s)&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected override
   void Dispose(bool disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (!disposed)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;
   &amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&lt;span lang=FR style="mso-ansi-language: FR"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   // dispose-only, i.e. non-finalizable logic&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   &amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;//
   new shared cleanup logic&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;disposed
   = true;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   base.Dispose(disposing);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span lang=FR style="mso-ansi-language: FR"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Notice that it does not re-implement
   Dispose or Finalize as its parent class already does so. The base type implementations
   will correctly forward to the most derived Dispose(bool) method so that resource cleanup
   occurs in the correct order.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt"&gt;
   &lt;b&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Example w/ Finalize (C++)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;Implementing this in C++ can
   be accomplished using the new syntax:&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public
   ref class ComplexCleanupBase&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;bool
   disposed;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ComplexCleanupBase()
   : disposed(false)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   allocate resources&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   implicitly implements IDisposable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;virtual
   ~ComplexCleanupBase()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Console::WriteLine("Base::~dtor");&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (!disposed)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   dispose-only, i.e. logic not suitable for finalizer&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;this-&amp;gt;!ComplexCleanupBase();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;disposed
   = true;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;virtual
   !ComplexCleanupBase()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Console::WriteLine("Base::!finalizer");&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (!disposed)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;disposed
   = true;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;};&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Overriding dispose behavior
   is done as follows. Notice that the chaining to base class cleanup logic happens automatically:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public
   ref class ComplexCleanupExtender : ComplexCleanupBase&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   some new fields that require cleanup&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;bool
   disposed;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ComplexCleanupExtender()
   : disposed(false)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   allocate more resources&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;virtual
   ~ComplexCleanupExtender()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Console::WriteLine("Extender::~finalizer");&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (!disposed)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;//
   dispose-only, i.e. logic not suitable for finalizer&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;this-&amp;gt;!ComplexCleanupExtender();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;disposed
   = true;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;virtual
   !ComplexCleanupExtender()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Console::WriteLine("Extender::!finalizer");&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (!disposed)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   shared cleanup logic&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;disposed
   = true;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;};&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt"&gt;
   &lt;b&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Versioning Considerations&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;If you choose to add this pattern
   to an existing unsealed class, you might end up unintentionally affecting existing
   subclasses. For the same reasons changing semantic contracts between a base and derived
   class can cause subtle breaking changes, introducing the concept of disposability
   into the base of a class hierarchy where it previously didn&amp;#8217;t exist can be problematic.
   Further, you might introduce new compilation warnings for existing subclasses when
   adding a new method to a base class. This section briefly summarizes a few things
   you should carefully analyze as part of making such a decision.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo4; tab-stops: list .5in"&gt;
   &lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#183;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;Introducing
   a public void Dispose() or protected virtual void Dispose(bool) method into an existing
   class hierarchy could cause C# compiler warnings for subclasses which have introduced
   disposability themselves, i.e. &amp;#8220;hiding inherited member, add new or override
   to make intent explicit.&amp;#8221; This is a source-level breaking change, possibly preventing
   compilation for developers treating warnings as errors.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo4; tab-stops: list .5in"&gt;
   &lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#183;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;Introducing
   a protected virtual void Dispose(bool) method could result in missed disposes for
   subclasses which have already implemented Dispose(bool). The subclass Dispose(bool)
   will not have been written to chain to its base (since no Dispose(bool) existed previously).
   Thus, when calling Dispose() on the derived type, it will not automatically result
   in a call to its base, meaning that resources will be temporarily leaked, and could
   even result in finalization being skipped if the further derived type makes a call
   to GC.SuppressFinalize. If you own the subclasses, of course, you can easily change
   this by adding a call to base.Dispose(bool). But for types shipped publicly, consider
   that one of your users might have authored subclasses.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo4; tab-stops: list .5in"&gt;
   &lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#183;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;If
   you are subclassing a disposable type that does not follow this pattern exactly, you&amp;#8217;ll
   likely run into a few challenges. The following table describes how to &amp;#8220;correct&amp;#8221;
   such a subclass both so that you may correctly hook into resource lifetime. This also
   corrects the subclass so that further derived classes are presented with a clear contract
   which follows this pattern. The cases considered include what to do if the base implements
   IDisposable publicly, privately, or not at all; where the base does or doesn&amp;#8217;t
   have a virtual Dispose(bool); and/or the base does or doesn&amp;#8217;t have an override
   of Finalize:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;table class=MsoNormalTable style="MARGIN: auto auto auto 0.75in; WIDTH: 479.85pt; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 0in 0in 0in" cellspacing=0 cellpadding=0 width=640 border=0&gt;
      &lt;tbody&gt;
         &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1.5pt solid; BACKGROUND-COLOR: transparent" valign=top width=108 rowspan=2&gt;
               &lt;p class=TableHeader style="MARGIN: 3pt 0in"&gt;
                  &lt;font size=2&gt;&lt;font color=#000000&gt;&lt;strong&gt;Base has Dispose?&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;
               &lt;/p&gt;
               &lt;p class=TableHeader style="MARGIN: 3pt 0in"&gt;
                  &lt;font size=2&gt;&lt;font color=#000000&gt;&lt;strong&gt;&lt;span style="FONT-FAMILY: Wingdings"&gt;&amp;#224;&lt;/span&gt;
                  &lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1.5pt solid; BACKGROUND-COLOR: transparent" valign=top width=128 rowspan=2&gt;
               &lt;p class=TableHeader style="MARGIN: 3pt 0in"&gt;
                  &lt;font size=2&gt;&lt;font color=#000000&gt;&lt;strong&gt;Base has virtual 
                  &lt;br&gt;
                  Dispose(bool)?&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1.5pt solid; BACKGROUND-COLOR: transparent" valign=top width=93 rowspan=2&gt;
               &lt;p class=TableHeader style="MARGIN: 3pt 0in"&gt;
                  &lt;font size=2&gt;&lt;font color=#000000&gt;&lt;strong&gt;Base has Finalize?&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;
               &lt;/p&gt;
               &lt;p class=TableHeader style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
                  &lt;font size=2&gt;&lt;font color=#000000&gt;&lt;strong&gt;&lt;span style="FONT-FAMILY: Wingdings"&gt;&amp;#223;&lt;/span&gt;
                  &lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 233.2pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=311 colspan=3&gt;
               &lt;p class=TableHeader style="MARGIN: 3pt 0in"&gt;
                  &lt;font size=2&gt;&lt;font color=#000000&gt;&lt;strong&gt;What to do when deriving?&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 1"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 92.2pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1.5pt solid; BACKGROUND-COLOR: transparent" valign=top width=123&gt;
               &lt;p class=TableHeader style="MARGIN: 3pt 0in"&gt;
                  &lt;font size=2&gt;&lt;font color=#000000&gt;&lt;strong&gt;IDisposable&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;
               &lt;/p&gt;
               &lt;p class=TableHeader style="MARGIN: 3pt 0in"&gt;
                  &lt;font size=2&gt;&lt;font color=#000000&gt;&lt;strong&gt;&lt;span style="FONT-FAMILY: Wingdings"&gt;&amp;#224;&lt;/span&gt;
                  &lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: windowtext 1pt solid; WIDTH: 65.85pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1.5pt solid; BACKGROUND-COLOR: transparent" valign=top width=88&gt;
               &lt;p class=TableHeader style="MARGIN: 3pt 0in"&gt;
                  &lt;font size=2&gt;&lt;font color=#000000&gt;&lt;strong&gt;Virtual Dispose (bool)&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: windowtext 1pt solid; WIDTH: 75.15pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1.5pt solid; BACKGROUND-COLOR: transparent" valign=top width=100&gt;
               &lt;p class=TableHeader style="MARGIN: 3pt 0in"&gt;
                  &lt;font size=2&gt;&lt;font color=#000000&gt;&lt;strong&gt;Override Finalize&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;
               &lt;/p&gt;
               &lt;p class=TableHeader style="MARGIN: 3pt 0in"&gt;
                  &lt;strong&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: Wingdings"&gt;&amp;#223;&lt;/span&gt;
                  &lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 2"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 92.2pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=123 rowspan=4&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;implement public
                  sealed&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: windowtext 1pt solid; WIDTH: 65.85pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=88 rowspan=12&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;if not already
                  present in base then create protected,&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;else override&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: windowtext 1pt solid; WIDTH: 75.15pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=100 rowspan=12&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;if overridden
                  but not sealed in base then re-override and seal 
                  &lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 3"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 4"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 5"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 6"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;publicly&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 92.2pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=123 rowspan=4&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;reimplement with
                  private sealed&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 7"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;publicly&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 8"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;nonpublicly&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 9"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;nonpublicly&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 10"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;publicly&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 92.2pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=123 rowspan=4&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;if base version
                  is not sealed then override public sealed&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 11"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;publicly&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 12"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;nonpublicly&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;no&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr style="mso-yfti-irow: 13; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 80.75pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=108&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;nonpublicly&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 96.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=128&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #ece9d8; WIDTH: 69.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent" valign=top width=93&gt;
               &lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
                  &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;yes&lt;o:p&gt;&lt;/o:p&gt;
                  &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
      &lt;/tbody&gt;
   &lt;/table&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;a name=_Toc98745877&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 1pt; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN: 6pt 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-add-space: auto; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;
      &lt;font color=#000080&gt;&lt;span style="mso-bookmark: _Toc98745877"&gt;&lt;font face=Arial&gt;Annotation
      (&lt;st1:PersonName w:st="on"&gt;Herb Sutter&lt;/st1:PersonName&gt;
      ): This table is drawn from what the C++ compiler generates automatically when it
      detects a base class not following the Dispose pattern as described in this section&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-bookmark: _Toc98745877"&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;.&lt;/span&gt;
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/span&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;h3 style="MARGIN: 16pt 0in 6pt 0.5in"&gt;&lt;font size=5&gt;&lt;font color=#000000&gt;&lt;span style="mso-bookmark: _Toc98745877"&gt;&lt;span style="mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana"&gt;&lt;span style="mso-list: Ignore"&gt;1.1.3 &lt;/span&gt;&lt;/span&gt;Dispose&lt;/span&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/h3&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;If a type is implementing disposability
   either through the pattern described above or a simple implementation of the IDisposable
   interface, the following guidelines apply. Note that these pertain to any code that
   runs during the disposal of an instance&amp;#8212;either inside Dispose(), Dispose(bool),
   or any other methods that might get called during Dispose.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt"&gt;
   &lt;b&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Authoring Disposable Classes&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; implement
   IDisposable on every type that has a finalizer. This gives users of your type a means
   to explicitly perform deterministic cleanup of those same resources which the finalizer
   is responsible for. You may also implement Dispose on types without finalizers, e.g.
   in circumstances when transitively disposing of object state or using objects which
   manage their resources with finalizers already.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Jeffrey Richter&lt;/st1:PersonName&gt;
      ): This guideline is very important and should always be followed without exception.
      Without this guideline, a user of a type can't control the resource properly. 
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Herb Sutter&lt;/st1:PersonName&gt;
      ): Languages ought to warn on this case. If you have a finalizer, you want a destructor
      (Dispose). The only exception is value types, because you can&amp;#8217;t have either
      a destructor or a finalizer (because the CLR makes arbitrarily many bitwise copies,
      it isn&amp;#8217;t possible to write teardown correctly for value types).&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; allow
   your Dispose method to be called more than once. The method may choose to do nothing
   after the first call. It should not generate an exception.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Brian Grunkemeyer&lt;/st1:PersonName&gt;
      ): A Dispose(bool) method may be called multiple times because of resurrection (i.e.
      someone calling GC.ReRegisterForFinalization on your instance), or because a verifiable
      program called either Dispose(void) or Finalize() on your object multiple times. &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;While
      rare, strange, and often frowned upon, these aren&amp;#8217;t strictly illegal.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Herb Sutter&lt;/st1:PersonName&gt;
      ): Unfortunately, having Dispose(bool) called multiple times isn&amp;#8217;t that strange&amp;#8230;
      it&amp;#8217;s what C#&amp;#8217;s automatically generated finalizer chaining does to the
      Dispose(bool) pattern by default, and why when authoring class hierarchies in C# it&amp;#8217;s
      especially important to implement the Dispose(bool) pattern only once in the class
      hierarchy. See 
      &lt;st1:PersonName w:st="on"&gt;Joe Duffy&lt;/st1:PersonName&gt;
      &amp;#8217;s annotation earlier in this chapter for more details.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; transitively
   dispose of any disposable fields defined in your type from your Dispose method. You
   should call Dispose() on any fields whose lifecycle your object controls. For example,
   consider a case where your object owns a private TextReader field. In your type's
   Dispose, you should call the TextReader object's Dispose, which will in turn dispose
   of its disposable fields (Stream and Encoding, for example), and so on. If implemented
   inside a Dispose(bool disposing) method, this should only occur if the disposing parameter
   is true&amp;#8212;touching other managed objects is not allowed during finalization. Additionally,
   if your object doesn&amp;#8217;t own a given disposable object, it should not attempt
   to dispose of it, as other code could still rely on it being active. Both of these
   could lead to subtle-to-detect bugs. 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=AnnotationCxSpFirst style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Herb Sutter&lt;/st1:PersonName&gt;
      ): In C++, you can just follow the natural idiom of storing any other objects whose
      lifetime is controlled by your own object as being directly held by value, and the
      above is done automatically. In this example, you&amp;#8217;d hold the TextReader by value:&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;o:p&gt;
         &lt;font face=Arial color=#000080&gt;&amp;nbsp;&lt;/font&gt;
      &lt;/o:p&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;ref
      class R {&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
      &amp;#8230;&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;private:&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;TextReader
      tr; // by value, not by reference (^)&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;o:p&gt;
         &lt;font face=Arial color=#000080&gt;&amp;nbsp;&lt;/font&gt;
      &lt;/o:p&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpLast style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 6pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Here R::~R() will automatically call tr.~TextReader(),
      following the usual C++ semantics. (More specifically, in the compiler-generated machinery
      R.Dispose(true) will invoke tr.Dispose().)&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Consider&lt;/u&gt; setting
   disposed fields to null before actually executing dispose when reference cycles in
   an object graph are possible. For example, consider this situation:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class CyclicClassA : IDisposable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private TextReader
   myReader;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span lang=FR style="mso-ansi-language: FR"&gt;private
   CyclicClassB cycle;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   public void Dispose()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span lang=FR style="mso-ansi-language: FR"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   if (myReader != null)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   ((IDisposable)myReader).Dispose();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;myReader = null;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   if (cycle != null)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span lang=FR style="mso-ansi-language: FR"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   CyclicClassB b = cycle;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   cycle = null;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span lang=FR style="mso-ansi-language: FR"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;b.Dispose();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class CyclicClassB : IDisposable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private Bitmap bmp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span lang=FR style="mso-ansi-language: FR"&gt;private
   CyclicClassA cycle;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   public void Dispose()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span lang=FR style="mso-ansi-language: FR"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   if (bmp != null)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   bmp.Dispose();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   bmp = null;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   if (cycle != null)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span lang=FR style="mso-ansi-language: FR"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   CyclicClassA a = cycle;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=FR style="mso-ansi-language: FR"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   cycle = null;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span lang=FR style="mso-ansi-language: FR"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;a.Dispose();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;In this example, given an instance
   of CyclicClassA &lt;i&gt;a&lt;/i&gt; and CyclicClassB &lt;i&gt;b&lt;/i&gt;, if &lt;i&gt;a&lt;/i&gt;.cycle = &lt;i&gt;b&lt;/i&gt; and &lt;i&gt;b&lt;/i&gt;.cycle
   = &lt;i&gt;a&lt;/i&gt;, transitive disposal would ordinarily cause an infinite loop. In the above
   example, notice that the object&amp;#8217;s state is nulled out first to prevent such
   a cyclic loop from happening.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Avoid&lt;/u&gt; throwing
   an exception from within Dispose except under critical situations where the containing
   process has been corrupted (leaks, inconsistent shared state, etc.). Users expect
   that a call to Dispose would not normally raise an exception. For example, consider
   the manual try-finally in this snippet:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;void NaiveConsumer()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TextReader tr = new
   StreamReader(File.OpenRead("foo.txt"));&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   do some stuff&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; finally&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;tr.Dispose();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   more stuff&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;If Dispose could raise an exception,
   further finally block cleanup logic will not execute. To work around this, the user
   would need to wrap every call to Dispose (within their finally block!) in a try block,
   which leads to very complex cleanup handlers. If executing a Dispose(bool disposing)
   method, never throw an exception if disposing is false. Doing so will terminate the
   process if executing inside a finalizer context.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Consider&lt;/u&gt; making
   your object unusable after calling Dispose. Recreating an object that has already
   been disposed is often a difficult undertaking, especially in cases where transitive
   disposals have taken place. In such circumstances, invoking further operations on
   a disposed object should throw an ObjectDisposedException. If you are able to reconstruct
   state, be sure to warn users that they must potentially re-dispose of an object multiple
   times, the first time and once again after each reconstruction.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;The following example demonstrates
   one possible approach for recreation. It is meant to show the concept only, not to
   convey any specific pattern to follow:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;class Recreatable : IDisposable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private bool disposed
   = false;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Dispose()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   Dispose(true);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   this.disposed = true;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   GC.SuppressFinalize(this);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Dispose(bool) implementation&amp;#8230;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // whenever you call
   a method that access the resources of&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // this class, check
   to see if the state is disposed, if 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // so, reopen this
   resource.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void DoStuff()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if
   (disposed)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ReOpen();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//do
   the work&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Note: The following
   code does not handle thread-safety&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // issues, it is meant
   to convey the concept only.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void ReOpen()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.disposed
   = false;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;GC.ReRegisterForFinalization(this);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;handle
   = //get new&amp;nbsp; handle 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;otherRes
   = new OtherResource();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; implement
   a Close method for cleanup purposes if such terminology is standard, for example as
   with a file or socket. When doing so, it is recommended that you make the Close implementation
   identical to Dispose, as we&amp;#8217;ve set this precedent with Framework types as early
   as V1.0. Most developers will not think to call both Close and Dispose on an object,
   but instead will call one or the other. Try to delegate cleanup responsibility to
   Dispose (e.g. by calling Close() from Dispose()) in such circumstances, and make sure
   to carefully document any situations that deviate from this pattern. 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Note that one such scenario
   that would justify deviation is if an object can be opened and closed multiple times
   without recreating the instance. For example, the .NET Framework uses this pattern
   with the System.Data.SqlClient.SqlConnection class. You are able to open and close
   a connection to the database multiple times, but an instance should still be disposed
   of afterwards. Optionally, you can release resources upon Close and lazily reacquire
   them in instances where multiple opens are possible.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Consider&lt;/u&gt; nulling
   out large managed object fields in your Dispose method. This is seldom necessary,
   but should be considered when a field is expensive to keep around, yet its owning
   object might be held on to longer than necessary. Simply because Dispose was called
   does not mean that its reference is being released. This could happen, for example,
   if its container (the object being disposed) is referred to from within a long-running
   scope (or stored in a static variable), and not explicitly nulled out. Doing this
   could help to reduce the lifetime of the object by making it eligible for garbage
   collection sooner. The definition of large and expensive is of course subjective and
   should be based on performance profiling and measurement.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Avoid&lt;/u&gt; creating
   disposable value types, and never create a value type which manages the lifetime of
   unmanaged resources directly. Except for situations where a value type will never
   be copied (e.g. existing only as a local within a method body) or only copied in very
   controlled ways, it is in practice difficult to predict how disposing of a value type
   will interact with the pass-by-copy semantics. For example, once a new copy has been
   handed out, one copy could try to access fields that another copy had already disposed.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt"&gt;
   &lt;b&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Working With Disposable
   Objects&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Consider&lt;/u&gt; disposing
   of any IDisposable object instances when you are done with them. This is covered partially
   by the rule above which states objects should transitively dispose of disposable fields,
   but also should be taken into consideration also with local object allocations. You
   should dispose of locals whose reference never leaves the code block in which they
   reside prior to exiting the block. The easiest way to do this in C# is with the using
   statement. The easiest way to do this in C++ is by allocating objects on the stack
   (the default).&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Be careful, however, not to
   dispose of an object while it is still in use. Unlike finalization, it&amp;#8217;s very
   easily to accidentally clean up resources on an object which is still actively in
   use.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; swallow exceptions arising from a call to Dispose. Invoking Dispose on any
   object will only ever throw an exception in very critical circumstances. In such cases,
   it would not be prudent to catch and attempt to continue executing as normal.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt"&gt;
   &lt;b&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;C# and VB Using Statement,
   C++ Stack Semantics&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;The C# and VB languages offer
   a using statement, and the C++ language offers stack allocation semantics, to make
   it easier for developer to work with disposable objects by automatically disposing
   when control leaves a precise scope. This happens regardless of whether this occurs
   through normal control flow or as a result of an exception.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;In C# and VB, using is appropriate
   for fine-grained scopes, where the life of an object spans an easily defined block
   of code. For longer spanning lifetimes, such as disposable fields, you will instead
   have to invoke Dispose directly on an object. In C++, holding fields by value is appropriate
   for disposable fields that are linked to the lifetime of their enclosing object (e.g.,
   &amp;#8220;OtherType t;&amp;#8221; instead of &amp;#8220;OtherType^ t;&amp;#8221; where ^ is an object
   reference indirection). The fields&amp;#8217; Disposers will be called automatically when
   the enclosing object is destroyed, regardless of whether this occurs through normal
   control flow or as a result of an exception.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;For example, the following
   C# code:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;void UseDisposableObject()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;using
   (Resource r = new Resource())&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   use the resource&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;which is equivalent to the
   following C++ code:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;void UseDisposableObject()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Resource
   r;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   use the resource&lt;br&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;gets expanded to IL which looks
   very similar to the following C# code:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;void UseDisposableObject()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Resource
   resource = new Resource();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;try 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   use the resource&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;finally&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (resource != null)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;((IDisposable)resource).Dispose();&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Notice how the using statement
   cleans up the code at the call-site quite a bit, making dispose much more attractive
   from the developer&amp;#8217;s point of view. You can also write &amp;#8220;stacked&amp;#8221;
   using statements which get translated into the obvious boilerplate try/finally blocks:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;using (Resource r1 = new Resource())&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;using (Resource r2 = new Resource())&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   use r1 and r2&lt;br&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;a name=_Toc98745878&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;which
   is equivalent to the following C++ code:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-bookmark: _Toc98745878"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-bookmark: _Toc98745878"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Resource
   r1;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-bookmark: _Toc98745878"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Resource
   r2;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-bookmark: _Toc98745878"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   use r1 and r2&lt;br&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;h3 style="MARGIN: 16pt 0in 6pt 0.5in"&gt;&lt;font size=5&gt;&lt;font color=#000000&gt;&lt;span style="mso-bookmark: _Toc98745878"&gt;&lt;span style="mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana"&gt;&lt;span style="mso-list: Ignore"&gt;1.1.4 &lt;/span&gt;&lt;/span&gt;Finalization&lt;/span&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/h3&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;If you choose to implement
   finalization logic for your type, you should take care to do it in the correct manner.
   Finalizers are notoriously difficult to implement correctly, primarily because you
   cannot make certain (normally valid) assumptions about the state of the system around
   you during their execution. The following guidelines should be taken into careful
   consideration.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Note that these guidelines
   apply not just to the Finalize (C# ~T(), C++ !T()) method, but to any code that executes
   during finalization. In the case of the Dispose pattern defined above, this means
   logic which executes inside Dispose(bool disposing) when disposing is false.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; carefully
   consider any case where you think a finalizer is needed. There is a real cost associated
   with instances with finalizers, both from a performance and code complexity standpoint.
   Prefer using resource wrappers such as SafeHandle to encapsulate unmanaged resources
   where possible, in which case a finalizer becomes unnecessary because the wrapper
   is responsible for its own resource cleanup&amp;#8212;refer to section 1.1.4 for more
   details.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Finalization increases the
   cost and duration of your object&amp;#8217;s lifetime as each finalizable object must
   be placed on a special finalizer registration queue when allocated, essentially creating
   an extra pointer-sized field to refer to your object. Moreover, objects in this queue
   get walked during GC, processed, and eventually promoted to yet another queue that
   the GC uses to execute finalizers. Increasing the number of finalizable objects directly
   correlates to more objects being promoted to higher generations, and an increased
   amount of time spent by the GC walking queues, moving pointers around, and executing
   finalizers. Also, by keeping your object&amp;#8217;s state around longer, you tend to
   use memory for a longer period of time, which leads to an increase in working set.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; make
   your Finalize method protected, not public or private. C# and C++ developers do not
   need to worry about this, as the compiler does it for you automatically.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; free
   only owned unmanaged resources in your type&amp;#8217;s Finalize method. Do not touch
   any finalizable objects your type may have a reference to, as there is significant
   risk that they will have already been finalized. Even managed objects whose lifecycle
   you own could be in an inconsistent state.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;For example, a finalizable
   object &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt; that has a reference to another
   finalizable object &lt;i style="mso-bidi-font-style: normal"&gt;b&lt;/i&gt; cannot reliably use &lt;i style="mso-bidi-font-style: normal"&gt;b&lt;/i&gt; in &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;&amp;#8217;s
   finalizer, or vice versa. There is no ordering among finalizers (short of a weak ordering
   guarantee for critical finalization). Also, objects stored in static variables will
   get collected at certain points during an appdomain unload or while exiting the process.
   Accessing a static variable that refers to a finalizable object (or calling a static
   method that may use values stored in static variables, like any sort of tracing infrastructure
   that writes to a file) is not safe, though you can use Environment.HasShutdownStarted
   (in v1.1 and higher) to detect whether your finalizer is running during an AD unload
   or while exiting the process.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Jeffrey Richter&lt;/st1:PersonName&gt;
      ): Note that it is OK to touch unboxed value type fields.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; directly call the Finalize method. This is not a legal operation in C#, but
   is possible in VB and C++, and is in fact verifiable IL. While these guidelines suggest
   writing finalizers that are resilient to being called under the worst possible circumstances,
   developers might still assume that a finalizer will only be called by the CLR&amp;#8217;s
   finalization thread.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt;&lt;i&gt; &lt;/i&gt;gracefully
   handle situations in which your finalizer is invoked more than once. This means you
   might need a way to detect whether finalization has already occurred on a given instance.
   As described in the following examples, it is sometimes necessary to detect and code
   against. Consider nulling or zero-ing out resource references and handles and checking
   for these conditions during finalization to skip cleanup logic. Alternatively, if
   detection isn&amp;#8217;t so simple, consider adding a boolean flag to indicate whether
   finalization has already occurred.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;As an example of two instances
   in which a Finalize() method could be run more than once, consider the following:
   1) As indicated above, verifiable IL can explicitly invoke the Finalize() method on
   your object multiple times. 2) Any arbitrary, untrusted caller who has a reference
   to your object can invoke GC.ReRegisterForFinalize during their own finalization.
   If your object has already been finalized, this will sign it up for an additional
   trip through the finalization process.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; assume your object is unreachable during finalization. Other objects that
   are with you in the finalizer queue might still have live references with which they
   could access your state, potentially even after you&amp;#8217;ve run your finalizer. You
   should be sure to detect inconsistent state during execution of any methods that might
   compromise security and other object invariants resulting from this behavior.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Brian Grunkemeyer&lt;/st1:PersonName&gt;
      ): Note that your finalizer may run while instance methods on your type are running
      as well. If you define a finalizer that closes a resource used by your type, you may
      need to call GC.KeepAlive(this) at the end of any instance method that doesn&amp;#8217;t
      use the this pointer after doing some operation on that resource. If you can use SafeHandle
      to encapsulate your resource, you can almost always remove the finalizer from your
      type, which means you no longer have to worry about this race with your own finalizer.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; assume your finalizer will always run. In some very rare circumstances only
   critical finalizers will be run, and in even rarer conditions no finalizers will ever
   get a chance to execute.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Precisely when and how and
   when this can occur differs based on whether you are running unhosted or in a hosted
   environment. In unhosted scenarios, finalization for an object can be skipped during
   timed-out process exits, if a finalizer thread is aborted after it has dequeued your
   object and before it has called Finalize (in which case, the runtime proceeds to the
   next object in the queue), or if a process is terminated without a managed shutdown
   (e.g. PInvoke to kernel32!ExitProcess). In hosted scenarios these conditions also
   apply, but the host can further initiate a rude AppDomain unload, in which case only
   critical finalizers are given a chance to execute. In SQL Server hosting, for example,
   normal AppDomain unloads will escalate to a rude unload should a thread or finalizer
   not respond within an acceptable timeframe.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Even in the absence of one
   of the rare situations noted above, a finalizable object with a publicly accessible
   reference could have its finalization suppressed by any arbitrary untrusted caller.
   Specifically, they can call GC.SuppressFinalize on you and prevent finalization from
   occurring altogether, including critical finalization. A good mitigation strategy
   to deal with this is to wrap critical resources in a non-public instance that has
   a finalizer. So long as you do not leak this to callers, they will not be able to
   suppress finalization. If you migrate to using SafeHandle in your class and never
   expose it outside your class, you can guarantee finalization of your resources (with
   the caveats mentioned above and assuming a correct SafeHandle implementation).&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Consider&lt;/u&gt; using
   a critical finalizable object (SafeHandle, or any type whose type hierarchy contains
   CriticalFinalizerObject) for situations where a finalizer absolutely must execute
   even in the face of AppDomain unloads and rude thread aborts. Refer to the section
   above on SafeHandles for more information.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Avoid&lt;/u&gt; allocating
   memory in finalizers. Allocations may fail due to lack of memory, and finalizers should
   be simple enough that they don&amp;#8217;t fail.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; allocate memory from within a critical finalizer, or from SafeHandle&amp;#8217;s
   ReleaseHandle method, at least not on the success paths. These methods are constrained
   execution regions, and as such, developers agree to be constrained to only calling
   a reliable subset of the Framework marked with appropriate reliability contracts.
   If your critical finalizer detects corruption or gets a bad error code from Win32,
   throwing an exception may be a reasonable way of reporting this failure (though for
   SafeHandle&amp;#8217;s ReleaseHandle method, returning false is preferred). Note that
   unhandled exceptions thrown on the finalizer thread will tear down unhosted processes.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; call virtual members from finalizers except for in very controlled designs,
   such as the Dispose(bool) method outlined in the pattern above. Even in these cases,
   malicious subclasses could inject harmful behavior into the virtual method call, possibly
   resulting in surprising behavior, such as an unhandled exception. This is because
   the most derived implementation of the virtual method will be run and there is no
   guarantee that it will chain to its base class as it is supposed to.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Consider the C# example below,
   which demonstrates a dynamically dispatched call to Dispose. The author of Base likely
   expected Base&amp;#8217;s Dispose method to be called at some point (i.e. that any subclasses
   would &amp;#8220;chain&amp;#8221; upwards with a call to base.Dispose(), as would be enforced
   in all C++-authored derived classes for example), but in reality Derived&amp;#8217;s version
   of Dispose never does this. This results in base class resources not being freed,
   and likely memory leaks. If the Derived Dispose() method suppressed finalization,
   resources that Base owns might not even get freed during finalization!&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class Base : IDisposable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public virtual void
   Dispose() //BUG: This method shouldn&amp;#8217;t be virtual.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   Console.WriteLine("Base's Cleanup");&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GC.SuppressFinalize(this);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~Base()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   Dispose();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class Derived : Base&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public override void
   Dispose()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   Console.WriteLine("Derived Cleanup");&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GC.SuppressFinalize(this);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~Derived() // BUG:
   Shouldn&amp;#8217;t override finalizer.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   Dispose();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;A few potential solutions for
   this problem are to make Dispose non-virtual, inject a private DisposeImpl method
   that Base&amp;#8217;s Dispose method delegates to and that the finalizer calls explicitly.
   This is a risk in general with the Dispose(bool) pattern outlined at the beginning
   of this section&amp;#8212;if subclasses never chain appropriately, the system can exhibit
   resource de-allocation problems.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Brian Grunkemeyer&lt;/st1:PersonName&gt;
      ): Note that with the above code, Derived&amp;#8217;s finalizer will run, then call Derived&amp;#8217;s
      Dispose method. The C# compiler also adds a try/finally to every finalizer that calls
      the base class finalizer, so Derived&amp;#8217;s finalizer will call Base&amp;#8217;s finalizer,
      which will virtually call Dispose, running Derived&amp;#8217;s finalizer a second time.
      This redundant call to Dispose also illustrates why a class hierarchy should only
      have one finalizer.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; write
   finalizers that are tolerant of partially constructed instances (i.e. objects whose
   constructors may have never completed). You should make sure to validate all assumed
   invariants that could affect a finalizer&amp;#8217;s execution.&amp;nbsp;Even resources that
   are allocated in an object&amp;#8217;s constructor might not be valid if an exception
   was thrown mid-way through construction. This might be more likely than you would
   think. If you do not explicitly throw from the constructor, a subclass might do so
   before chaining to the base class constructor, or one of many possible asynchronous
   infrastructure exceptions could have interrupted the constructor, for example. In
   these cases the finalizer will still execute, but some or all fields might not be
   fully initialized.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;For example, in the following
   code, list may be null if the constructor throws an exception before list is assigned
   to:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class MyClass&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   ArrayList list;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   MyClass()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   //some work&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;list
   = new ArrayList();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;~MyClass()
   //bug: list could be null&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   foreach (IntPtr i in list)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   CloseHandle(i);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Consider this fix to the finalizer
   which avoids an unhandled NullReferenceException from occurring on the finalizer thread
   (which would end up terminating the program):&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;~MyClass() //fixed 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (list != null)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;foreach
   (IntPtr i in list)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   CloseHandle(i);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Jeffrey Richter&lt;/st1:PersonName&gt;
      ): If a constructor throws an exception, the CLR will still call the object's Finalize
      method. So, when your Finalize method is called, the object's fields may not have
      all been initialized; your Finalize method should be robust enough to handle this.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; write
   finalizers that are threading-agnostic. Finalizers can execute in any order, on any
   thread, can occur on multiple objects concurrently, and even on the same object simultaneously.
   In general, the runtime makes no guarantees as to the threading policy of finalization,
   so you should avoid any dependency on how it might be implemented today.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=AnnotationCxSpFirst style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in 0pt; mso-add-space: auto"&gt;
      &lt;font face=Arial color=#000080&gt;Annotation (Chris Brumme): I describe the threading
      environment for finalization at &lt;/font&gt;&lt;a title=http://blogs.msdn.com/cbrumme/archive/2004/02/20/77460.aspx href="http://blogs.msdn.com/cbrumme/archive/2004/02/20/77460.aspx"&gt;&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"&gt;http://blogs.msdn.com/cbrumme/archive/2004/02/20/77460.aspx&lt;/span&gt;&lt;/a&gt;&lt;font color=#000080&gt;&lt;font face=Arial&gt;.
      &amp;nbsp;As you can see there, techniques like resurrection can cause your application
      threads and the finalizer thread to access your object concurrently. In other words,
      from a security perspective you should assume brutal multi-threading. &amp;nbsp;But in
      all other respects you should assume that only one thread is active in your object
      when you are finalizing or disposing. You are free to ignore this possibility so long
      as it doesn&amp;#8217;t cause security holes. If this is a security risk, you must fix
      it.&amp;nbsp; An obvious way to fix it is by adding thread safety to finalization.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;o:p&gt;
         &lt;font face=Arial color=#000080&gt;&amp;nbsp;&lt;/font&gt;
      &lt;/o:p&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpLast style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 6pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;StringBuilder is a good example of this. If you
      use a StringBuilder from multiple threads, you will get garbage text built up in the
      buffer. &amp;nbsp;That&amp;#8217;s the caller&amp;#8217;s problem.&amp;nbsp; But earlier implementations
      of StringBuilder actually exposed a security hole when used in this manner. It was
      possible to create mutable strings, where the result of StringBuilder.ToString could
      be modified. &amp;nbsp;This was a huge security hole and it was fixed. But the data integrity
      hole, is not a security hole and it will never be fixed. Consider the same sort of
      distinction when deciding whether to make your Finalize implementation thread-safe
      or not.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Brian Grunkemeyer&lt;/st1:PersonName&gt;
      ): The CLR may choose to use multiple finalizer threads in the future, and these could
      be threadpool threads or even your main thread. We need the freedom to run finalizers
      on these other threads, so we must impose this rather small additional burden on class
      authors.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Avoid&lt;/u&gt; blocking
   execution from within a finalizer. For example, do not perform synchronization or
   lock acquisition, sleep the thread, or any other similar operations, unless you have
   identified a real security or stress bug that would cause finalization to fail under
   the conditions discussed above. These operations could delay or even prevent other
   finalizers in the queue from running entirely, for example if the host notices a long-running
   block and responds by escalating to a rude abort. If you must execute atomic thread-safe
   operations, prefer the Interlocked class, as it is lightweight and non-blocking.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; raise unhandled exceptions or otherwise leak exceptions from your finalizer,
   except for in very system critical circumstances (such as OutOfMemory, for example).
   Doing so will shut down the entire process (as of V2.0), tearing down the application,
   and preventing other finalizers from executing and resources from being released in
   a controlled manner.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Avoid&lt;/u&gt; resurrecting
   yourself by setting a reference to a rooted context, i.e. through a GC reachable reference
   such as a static field or reachable objects to which you still have a reference. Re-registering
   an object has performance implications and can cause unexpected behavior. Objects
   you have references to might have already completed finalization, meaning it is almost
   never safe to resume normal execution once you&amp;#8217;ve been placed into the finalizer
   queue. If recycling objects, try to do so in your Dispose method instead, and only
   in Finalize as a last resort.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font face=Arial&gt;&lt;font color=#000080&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Rico Mariani&lt;/st1:PersonName&gt;
      ): This isn't especially a different issue than other finalization type issues. If
      you are recycling an unmanaged resource you may already need a finalizer. The time
      to recycle yourself is when you are Disposed. If you are getting finalized with any
      frequency at all you are already in trouble&amp;#8212;recycling doesn't put you in significantly
      more trouble. See &lt;i style="mso-bidi-font-style: normal"&gt;Objects: Release or Recycle?&lt;/i&gt;&lt;/font&gt;&lt;em&gt;&lt;span style="COLOR: blue; FONT-FAMILY: Arial"&gt;&amp;nbsp;&lt;/span&gt;&lt;/em&gt;&lt;font color=#000080&gt;(&lt;/font&gt;&lt;/font&gt;&lt;a href="http://blogs.msdn.com/ricom/archive/2004/02/11/71143.aspx"&gt;&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"&gt;http://blogs.msdn.com/ricom/archive/2004/02/11/71143.aspx&lt;/span&gt;&lt;/a&gt;&lt;font face=Arial color=#000080&gt;),&amp;nbsp;and
      look under Option Two for more details. Assuming that the finalization is happening
      infrequently this can be an excellent approach to avoiding &lt;i style="mso-bidi-font-style: normal"&gt;Mid
      Life Crisis&lt;/i&gt; (&lt;/font&gt;&lt;a href="http://weblogs.asp.net/ricom/archive/2003/12/04/41281.aspx"&gt;&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"&gt;http://weblogs.asp.net/ricom/archive/2003/12/04/41281.aspx&lt;/span&gt;&lt;/a&gt;&lt;font color=#000080&gt;&lt;font face=Arial&gt;).
      This guideline isn&amp;#8217;t intended to prohibit object pools, but rather to make sure
      you are considering any recycling policy with due care.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; assume that avoiding resurrecting yourself prevents you from being rooted
   again after or during finalization. This could occur, for example, if somebody behind
   you in the finalizer queue has a reference to you and becomes resurrected. Because
   finalization is unordered, there is no guarantee that this will not occur. At this
   point, your object will have already been finalized, but other objects could attempt
   to use you as though you were still alive. In these cases, you need to be sure not
   to break class invariants that may not hold after finalization has executed. Consider
   throwing an exception in these circumstances&amp;#8212;i.e. treat this as similar to the
   use of already disposed object as described above.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; modify thread context from within your finalizer, as it will end up polluting
   the finalizer thread. Remember, your finalizer will be executed on an entirely separate
   thread than what your object was executing on while it was alive. As such, don&amp;#8217;t
   leave the finalizer thread impersonated, access thread local storage, or put a weird
   culture on it, for example.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Brian Grunkemeyer&lt;/st1:PersonName&gt;
      ): Consider the finalizer thread more like a threadpool thread &amp;#8211; if you break
      it by polluting its state, you buy it.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; assume that, because some object is reachable while you&amp;#8217;re being finalized,
   that it has not been or is not in the process of being finalized&amp;#8212;e.g., static
   fields, common infrastructure, and so on. During AppDomain unloads or process shutdown,
   even critical infrastructure components may have begun or completed finalization,
   too. In such situations, the predicate method AppDomain.CurrentDomain.IsFinalizingForUnload()
   will evaluate to true.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=AnnotationCxSpFirst style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in 0pt; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (Brian Grunkemeyer): Back during the
      implementation of V1.0, I was debugging a problem where a finalizer didn&amp;#8217;t seem
      to be called. To help figure out if the finalizer was running at all, I added a call
      to Console.WriteLine inside it, but then my app started blowing up with an unhandled
      ObjectDisposedException. How could simply adding a call to Console.WriteLine to the
      finalizer break the app?&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpMiddle style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;
      &lt;o:p&gt;
         &lt;font face=Arial color=#000080&gt;&amp;nbsp;&lt;/font&gt;
      &lt;/o:p&gt;
   &lt;/p&gt;
   &lt;p class=AnnotationCxSpLast style="BACKGROUND: #e9fdf3; MARGIN: 0in 0in 6pt; mso-add-space: auto"&gt;
      &lt;font face=Arial&gt;&lt;font color=#000080&gt;The problem turned out to be that the underlying
      console stream was being finalized before my instance. The lesson I learned was to
      follow this guideline: only use non-finalizable instance data from your own finalizer&lt;/font&gt;&lt;span style="COLOR: #333399"&gt;.
      But I also happened to own the code for the Console class, so I special cased Console.WriteLine&amp;#8212;now
      we never close the handles for stdout, stdin, or stderr. This is somewhat useful for
      printf-style debugging and logging, and turned out later to be required to support
      multiple appdomains within the same process (i.e. you don&amp;#8217;t want arbitrary appdomains
      closing your process-wide handle for stdout). So bottom line: using Console from your
      finalizer is actually a safe thing to do, but watch out for everything else.&lt;/span&gt;
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do
   not&lt;/u&gt; define finalizers on value types. Only reference types get finalized by the
   CLR, and thus any attempt to place a finalizer on a value type will be ignored. The
   C# and C++ compilers enforce this rule.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=defaultparagraphfontparacharcharcharcharcharcharcharcharchar0 style="MARGIN: 0in 0in 8pt"&gt;
   &lt;a name=_Toc66761776&gt;&lt;/a&gt;&lt;a name=_Ref98309994&gt;&lt;/a&gt;&lt;b&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;C#
   Finalizers&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;The Finalize method is inherited
   from System.Object on every class, although only those that redefine it are eligible
   for finalization. C# has special syntax which makes writing finalizers easier, and
   in fact prevents you from overriding Finalize as though it were an ordinary method.
   The following code, for example:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class Resource&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~Resource ()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   de-allocate resources&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Gets translated by the C# compiler
   into the following conceptually equivalent (although illegal) C# snippet:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class Resource&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected override
   void Finalize()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;try&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   de-allocate resources&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;finally&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;base.Finalize();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Joe Duffy&lt;/st1:PersonName&gt;
      ): Earlier in the .NET Framework&amp;#8217;s lifetime, finalizers were consistently referred
      to as destructors by C# programmers. As we become smarter over time, we are trying
      to come to terms with the fact that the Dispose method is really more equivalent to
      a C++ destructor (deterministic), while the finalizer is something entirely separate
      (nondeterministic). The fact that C# borrowed the C++ destructor syntax (i.e. ~T())
      surely had at least a little to do with the development of this misnomer. Confusing
      the two has been unhealthy in general for the platform, and as we move forward the
      clear distinction between resource and object lifetime needs to take firm root in
      each and every managed software engineer&amp;#8217;s head.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Jeffrey Richter&lt;/st1:PersonName&gt;
      ): It is very unfortunate that the C# team chose to use the tilde syntax to define
      what is now called a finalizer. Programmers coming from an unmanaged C++ background
      naturally think that you get deterministic cleanup when using this syntax. I wish
      the team had chosen a symbol other than tilde; this would have helped developers substantially
      in learning how the .NET platform is different than the unmanaged architecture. 
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;h3 style="MARGIN: 16pt 0in 6pt 0.5in"&gt;&lt;a name=_Toc98745879&gt;&lt;font size=5&gt;&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana"&gt;&lt;span style="mso-list: Ignore"&gt;1.1.5 &lt;/span&gt;&lt;/span&gt;Dispose
   Pattern Example&lt;/font&gt;&lt;/font&gt;&lt;/a&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
&lt;/h3&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;This section shows a more complete
   and complex example of the dispose pattern in C#, as described in the above sections.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;using
   System;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;using
   System.Security;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;using
   System.ComponentModel;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;using
   System.Runtime.ConstrainedExecution;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;using
   System.Runtime.InteropServices;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public
   class ComplexWindow : IDisposable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   MySafeHandleSubclass handle; // pointer for a resource&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   Component component; // other resource you use&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   bool disposed = false;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   ComplexWindow()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;handle
   = CreateWindow("MyClass", "Test Window",&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span lang=PT-BR style="mso-ansi-language: PT-BR; mso-no-proof: yes"&gt;0,
   50, 50, 500, 900,&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span lang=PT-BR style="mso-ansi-language: PT-BR; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;IntPtr.Zero,
   IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span lang=PT-BR style="mso-ansi-language: PT-BR; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="mso-no-proof: yes"&gt;component
   = new Component();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   implements IDisposable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   void Dispose()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Dispose(true);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GC.SuppressFinalize(this);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;protected
   virtual void Dispose(bool disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (!this.disposed)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   if this is a dispose call dispose on all state you 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   hold, and take yourself off the Finalization queue.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (handle != null)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;handle.Dispose();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (component != null)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;component.Dispose();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;component
   = null;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   free your own state (unmanaged objects)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;AdditionalCleanup();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;this.disposed
   = true;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   finalizer simply calls Dispose(false)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;~ComplexWindow()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Dispose(false);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   some custom cleanup logic&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   void AdditionalCleanup()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   this method should not allocate or take locks, unless&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   absolutely needed for security or correctness reasons.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   since it is called during finalization, it is subject to&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   all of the restrictions on finalizers above.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   whenever you do something with this class, check to see if the&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   state is disposed, if so, throw this exception.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   void ShowWindow()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (this.disposed)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;throw
   new ObjectDisposedException("");&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   otherwise, do work&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[DllImport("user32.dll",
   SetLastError = true,&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CharSet
   = CharSet.Auto, BestFitMapping = false)]&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   static extern MySafeHandleSubclass CreateWindow(&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;string
   lpClassName, string lpWindowName, int dwStyle,&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;int
   x, int y, int nWidth, int nHeight, IntPtr hwndParent,&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;IntPtr
   Menu, IntPtr hInstance, IntPtr lpParam);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;internal
   sealed class SafeMyResourceHandle : SafeHandle&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   HandleRef href;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   called by P/Invoke when returning SafeHandles&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   SafeMyResourceHandle () : base(IntPtr.Zero, true)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   no need to provide a finalizer - SafeHandle's critical&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   finalizer will call ReleaseHandle for you.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   override bool IsInvalid&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;get
   { return handle == IntPtr.Zero; }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;override
   protected bool ReleaseHandle()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   this method is a constrained execution region, and&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   *must* not allocate 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;return
   DeleteObject(href);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[DllImport("gdi32.dll",
   SuppressUnmanagedCodeSecurity]&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[ReliabilityContract(Consistency.WillNotCorruptState,&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CER.Success)]&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   static extern bool DeleteObject(HandleRef hObject);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[DllImport("kernel32")]&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;internal
   static extern SafeMyResourceHandle CreateHandle(&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;int
   someState);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;// derived
   class&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public
   class MyComplexWindow : ComplexWindow&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   Component myComponent; // other resource you use&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   bool disposed = false;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   MyComplexWindow()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;myComponent
   = new Component();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;protected
   override void Dispose(bool disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (!this.disposed)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   free any disposable resources you own&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (myComponent != null)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;myComponent.Dispose();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;this.disposed
   = true;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   perform any custom clean-up operations&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   such as flushing the stream&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;base.Dispose(disposing);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Brian Grunkemeyer&lt;/st1:PersonName&gt;
      ): Note that the derived MyComplexWindow class above doesn&amp;#8217;t strictly need to
      add in its own disposed Boolean &amp;#8211; it could instead check to see whether myComponent
      was set to null in Dispose(bool) and in all methods that use that type. Dispose(bool)
      should still chain to its base class in all cases though. The drawback with this approach
      is it may be more difficult to maintain if you start adding multiple fields to your
      type.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;h3 style="MARGIN: 16pt 0in 6pt 0.5in"&gt;&lt;a name=_Toc98745880&gt;&lt;font size=5&gt;&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana"&gt;&lt;span style="mso-list: Ignore"&gt;1.1.6 &lt;/span&gt;&lt;/span&gt;SafeHandle&lt;/font&gt;&lt;/font&gt;&lt;/a&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
&lt;/h3&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;Using classes derived from
   SafeHandle allows you to wrap a handle to an unmanaged resource. It provides protection
   for handle recycling security attacks, critical finalization, and special managed/unmanaged
   interop marshaling. The expectation is that you will subclass SafeHandle (or a type
   like SafeHandleZeroOrMinusOneIsInvalid) for your own resource type.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=GuidelinePositive style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#254;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Do&lt;/u&gt; use
   SafeHandle for wrapping scarce unmanaged resources such as OS handles, preferring
   it to IntPtr or Int32 representations for native handles, e.g. as in:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;private SafeMyResourceHandle handle; 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=DefaultParagraphFontParaCharCharCharCharCharCharCharCharChar style="MARGIN: 0in 0in 8pt 0.25in"&gt;
   &lt;span style="FONT-FAMILY: Verdana"&gt;&lt;font color=#000000&gt;If your resource is very light-weight,
   such as a small unmanaged buffer for example, it is not subject to recycling attacks,
   and your scenario is very performance sensitive, you might consider avoiding SafeHandle.
   SafeHandle has many advantages, such as reducing the graph promotion due to Finalization,
   avoid recycling attacks, and guaranteeing no leaks even in the face of rude AppDomain
   unloading, but it may be too heavy-weight for very light-weight resources.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Brian Grunkemeyer&lt;/st1:PersonName&gt;
      ): Note that we publicly expose a few SafeHandle subclasses for commonly used handle
      types, like SafeFileHandle and SafeWaitHandle in the Microsoft.Win32.SafeHandles namespace.
      For a discussion of what led us to designing SafeHandle, read &lt;a href="http://blogs.msdn.com/bclteam/archive/2005/03/16/396900.aspx"&gt;http://blogs.msdn.com/bclteam/archive/2005/03/16/396900.aspx&lt;/a&gt;.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;h3 style="MARGIN: 16pt 0in 6pt 0.5in"&gt;&lt;a name=_Toc98745881&gt;&lt;font size=5&gt;&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana"&gt;&lt;span style="mso-list: Ignore"&gt;1.1.7 &lt;/span&gt;&lt;/span&gt;HandleCollector
   and Memory Pressure&lt;/font&gt;&lt;/font&gt;&lt;/a&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
&lt;/h3&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt 0.25in"&gt;
   &lt;span style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;span style="mso-list: Ignore"&gt;&amp;#253;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;u&gt;Avoid&lt;/u&gt; making
   calls to GC.Collect() and GC.GetTotalMemory(true)&lt;/font&gt;&lt;font color=#000000&gt; with
   the intent of controlling the GC&amp;#8217;s policy to provoke collecting resources eagerly.
   Calling GC.Collect() interferes with the natural GC collection&lt;b style="mso-bidi-font-weight: normal"&gt; &lt;/b&gt;schedule,
   which negatively impact performance of your application. In general, both methods
   were designed primarily for testing purposes. Use the System.Runtime.InteropServices.HandleCollector
   class or the GC.AddMemoryPressure methods in their place.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt; TEXT-INDENT: 0in; mso-list: none"&gt;
   &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;font color=#000000&gt;Handle Collector&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=Text style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;font color=#000000&gt;HandleCollector tracks unmanaged handles in order to initiate
   collections in response to specific thresholds (specified during construction) being
   met. Whenever allocating a resource which is managed by a collector, simply call Add;
   when freed, call Remove. Once the number of handles surpasses a given threshold, a
   GC will occur, hopefully cleaning up any excess resources that may be eligible.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #e9fdf3; PADDING-BOTTOM: 0in; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt;
   &lt;p class=Annotation style="BACKGROUND: #e9fdf3; MARGIN: 6pt 0in; mso-add-space: auto"&gt;
      &lt;font color=#000080&gt;&lt;font face=Arial&gt;Annotation (&lt;st1:PersonName w:st="on"&gt;Jeffrey Richter&lt;/st1:PersonName&gt;
      ): Internally, HandleCollector and AddMemoryPressure both call GC.Collect. So what
      this guideline is trying to say is that there are times when calling GC.Collect is
      useful but you should really try to avoid it if possible. If you do call GC.Collect,
      you should have a really good reason to do it and HandleCollector/AddMemoryPressure
      exist for good reasons: because it is better to force a collection and adversely affect
      performance than it is for your program to malfunction because it can't create another
      handle to an unmanaged resource or because there isn&amp;#8217;t enough unmanaged memory
      available to for a necessary allocation.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/font&gt;
   &lt;/p&gt;
&lt;/div&gt;
&lt;p class=Text style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;font color=#000000&gt;This snippet demonstrates how GDI handles can be limited to a
   threshold of between 10 and 50. The lower bound is where collection is suggested to
   begin, while the upper bound is a hard limit on the absolute number of resources that
   are available:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;HandleCollector collector = new HandleCollector("GdiHandles",
   10, 50);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;IntPtr CreateSolidBrush()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;collector.Add();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;try&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;return
   CreateSolidBrushImpl();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;catch&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   if allocation fails, decrement the live handle count&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;collector.Remove();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;throw;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;void DeleteBrush(IntPtr handle)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;DeleteObjectImpl(handle);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;collector.Remove();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=GuidelineNegative style="MARGIN: 6pt 0in 3pt; TEXT-INDENT: 0in; mso-list: none"&gt;
   &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;font color=#000000&gt;Add and Remove Memory
   Pressure&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=Text style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;font color=#000000&gt;Using GC.AddMemoryPressure gives hints to the GC when a managed
   object&amp;#8217;s cost is higher than it appears due to unmanaged resources. Pass to
   it the size of the unmanaged resource, and the GC will alter its collection strategy
   in response to the increased amount of pressure on an object. GC.RemoveMemoryPressure
   is used to reduce the pressure once the resources have been freed. For example, the
   following snippet of code demonstrates how to add and remove memory pressure each
   time a new Bitmap is acquired and released respectively:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class Bitmap : IDisposable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   long bmpSize;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   Bitmap(string path)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;bmpSize
   = new FileInfo(path).Length;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GC.AddMemoryPressure(bmpSize);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   allocation work&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   void Dispose()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Dispose(true);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GC.SuppressFinalize(this);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;protected
   void Dispose(bool disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   cleanup work&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GC.RemoveMemoryPressure(bmpSize);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;~Bitmap()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Dispose(false);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font face="Courier New"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font face="Courier New"&gt;&lt;font color=#000000&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Text style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Text style="MARGIN: 3pt 0in 3pt 0.25in"&gt;
   &lt;font color=#000000&gt;Note, however, that if you&amp;#8217;re allocating a large number
   of small byte allocations, it is more efficient to add and remove pressure in large
   chunks. For example, megabytes or 100&amp;#8217;s of kilobytes at a time. You might want
   to implement a special pressure manager class to handle this, as shown in the following
   snippet. The BitmapPressureManager class adds and removes memory pressure transactions
   in 500KB quantities of memory. The Bitmap class from above has been modified to call
   through to this new class instead:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;public class Bitmap : IDisposable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   long bmpSize;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   Bitmap(string path)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;bmpSize
   = new FileInfo(path).Length;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;BitmapPressureManager.AddMemoryPressure(bmpSize);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;//
   allocation work&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   void Dispose()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Dispose(true);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GC.SuppressFinalize(this);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;protected
   void Dispose(bool disposing)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
   cleanup work&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;BitmapPressureManager.RemoveMemoryPressure(bmpSize);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;~Bitmap()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Dispose(false);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;internal static class BitmapPressureManager&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   const long threshold = 524288; // only add pressure in 500KB chunks&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   static long pressure;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   static long committedPressure;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   static readonly object sync = new object();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;internal
   static void AddMemoryPressure(long amount)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Interlocked.Add(ref
   pressure, amount);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;PressureCheck();&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;internal
   static void RemoveMemoryPressure(long amount)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;AddMemoryPressure(-amount);&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;o:p&gt;
      &lt;font face="Courier New" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private
   static void PressureCheck()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (Math.Abs(pressure - committedPressure) &amp;gt;= threshold)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;lock
   (sync)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;long
   diff = pressure - committedPressure;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (Math.Abs(diff) &amp;gt;= threshold) // double check&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if
   (diff &amp;lt; 0)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GC.RemoveMemoryPressure(-diff);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;else&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GC.AddMemoryPressure(diff);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;committedPressure
   += diff;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font color=#000000&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font face="Courier New"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=Code style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;font face="Courier New"&gt;&lt;font color=#000000&gt;}&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.bluebytesoftware.com/blog/aggbug.ashx?id=88e62cdf-5919-4ac7-bc33-20c06ae539ae" /&gt;</description>
      <category>DesignGuideline;Technology</category>
    </item>
    <item>
      <trackback:ping>http://www.bluebytesoftware.com/blog/Trackback.aspx?guid=c310f497-6ec6-479b-b388-add078294963</trackback:ping>
      <pingback:server>http://www.bluebytesoftware.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.bluebytesoftware.com/blog/PermaLink,guid,c310f497-6ec6-479b-b388-add078294963.aspx</pingback:target>
      <dc:creator>
      </dc:creator>
      <title>DG Update: Generics and Performance</title>
      <guid>http://www.bluebytesoftware.com/blog/PermaLink,guid,c310f497-6ec6-479b-b388-add078294963.aspx</guid>
      <link>http://www.bluebytesoftware.com/blog/2005/03/23/DGUpdateGenericsAndPerformance.aspx</link>
      <pubDate>Wed, 23 Mar 2005 20:23:30 GMT</pubDate>
      <description>&lt;p&gt;
   This can probably fall into the &amp;#8220;paranoid programmer&amp;#8220; category... where
   this time the paranoia is not about async exceptions, but rather about pulling in
   the JIT unnecessarily.
&lt;/p&gt;
&lt;p&gt;
   Back in September, we did a fair amount of work documenting and getting FxCop rules
   in place to check when the use of generics can cause an NGen'd assembly to JIT. This
   was mostly in response to&amp;nbsp;our general no-JIT plan that most managed code we ship
   is on. In particular, Avalon drove us hard to come up with this.
&lt;/p&gt;
&lt;p&gt;
   Joel has a great&amp;nbsp;entry&amp;nbsp;about code sharing vis-a-vis generics &lt;a href="http://blogs.msdn.com/joelpob/archive/2004/11/17/259224.aspx"&gt;over
   on his blog&lt;/a&gt;. I'd read that alongside this.
&lt;/p&gt;
&lt;p&gt;
   (BTW, in re-reading my DG update entry before posting, I think there's some significant
   clarification and re-work that we could/should do. Add it to the growing stack of
   things to do! :))
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-FAMILY: Tahoma"&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;Generics
   and Performance&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;ul style="MARGIN-TOP: 0in" type=circle&gt;
   &lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: list .5in; mso-list: l0 level1 lfo4"&gt;
      &lt;font color=#000000&gt;&lt;u&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;Do&lt;/span&gt;&lt;/u&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt; consider
      the performance ramifications of generics. Specific recommendations arise from these
      considerations and are described in guidelines that follow. 
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/span&gt;&lt;/font&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Execution
   Time Considerations&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;ul style="MARGIN-TOP: 0in" type=circle&gt;
   &lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: list .5in; mso-list: l1 level1 lfo1"&gt;
      &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Generic collections
      over value types (e.g. List&amp;lt;int&amp;gt;) tend to be faster than equivalent collections
      of Object (e.g. ArrayList) because they avoid boxing items.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/span&gt; 
   &lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: list .5in; mso-list: l1 level1 lfo1"&gt;
      &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Generic collections
      over all types also tend to be faster because they do not incur a checked cast to
      obtain items from the collection.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/span&gt; 
   &lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: list .5in; mso-list: l1 level1 lfo1"&gt;
      &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;The static
      fields of a generic type are replicated, unshared, for each constructed type. The
      class constructor of a generic type is called for each constructed type. For example, 
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/span&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;public
   class Counted&amp;lt;T&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;public
   static int count;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public
   T t;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;static
   Counted()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;count
   = 0;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Counted(T
   t)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;this.t
   = t;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;++count;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;}&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Each constructed
   type Counted&amp;lt;int&amp;gt;, Counted&amp;lt;string&amp;gt;, etc. has its own copy of the static
   field, and the static class constructor is called once for each constructed type.
   These static member costs can quietly add up. Also, accesses to static fields of generic
   types may be slower than accesses to static fields of ordinary types. 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;ul style="MARGIN-TOP: 0in" type=circle&gt;
   &lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: list .5in; mso-list: l2 level1 lfo2"&gt;
      &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Generic methods,
      being generic, do not enjoy certain JIT compiler optimizations, but this is of little
      concern for all but the most performance critical code. For example, the optimization
      that a cast from a derived type to a base type need not be checked is not applied
      when one of the types is a generic parameter type.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/span&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Code
   Size Considerations&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;ul style="MARGIN-TOP: 0in" type=circle&gt;
   &lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: list .5in; mso-list: l2 level1 lfo2"&gt;
      &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;The CLR shares
      IL, metadata, and some JIT&amp;#8217;d/NGEN&amp;#8217;d native code across types/methods constructed
      from generic types/methods. Thus the space cost of each constructed type is modest,
      less than that of an empty conventional non-generic type. But see also &amp;#8216;current
      limitations&amp;#8217; below.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/span&gt; 
   &lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: list .5in; mso-list: l2 level1 lfo2"&gt;
      &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;When a generic
      type references other generic types, then each of its constructed types constructs
      its transitively referenced generic types. For example, List&amp;lt;T&amp;gt; references IEnumerable&amp;lt;T&amp;gt;,
      so use of List&amp;lt;string&amp;gt; also incurs the modest cost of constructing type IEnumerable&amp;lt;string&amp;gt;.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/span&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Current
   Code Sharing Limitations&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;In the current
   CLR implementation, native code method sharing for disparate generic type combinations
   occurs only for types constructed over reference type parameters (e.g., List&amp;lt;object&amp;gt;,
   List&amp;lt;string&amp;gt;, List&amp;lt;MyReferenceType&amp;gt;). Each type constructed over value
   type parameters (e.g., List&amp;lt;int&amp;gt;, List&amp;lt;MyStruct&amp;gt;, List&amp;lt;MyEnum&amp;gt;)
   will incur a separate copy of the native code for the methods in those constructed
   types. For comparison purposes, this is similar to the runtime cost of creating your
   own strongly typed collection class.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;A consequence
   of this is that using a generic type defined in mscorlib in combination with value
   type parameters also from mscorlib could cause an NGen image to invoke the JIT during
   execution, resulting in a negative effect on performance. This is limited to mscorlib
   because it is the only assembly always loaded domain-neutral, and for a variety of
   reasons there are limitations on code sharing when working with domain-neutral assemblies.
   (Note: domain-neutrality is a load time decision, so it is possible that this would
   affect other assemblies, too.) For generic types that take a single type parameter,
   for example, t is relatively straightforward to determine whether this will affect
   your scenario: When instantiating G&amp;lt;VT&amp;gt;, where generic type G and value type
   parameter VT are both defined in mscorlib, you will JIT unless G&amp;lt;VT&amp;gt; is found
   in the following list:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;ArraySegment&amp;lt;Byte&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;Boolean&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;Byte&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;Char&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;DateTime&amp;gt; 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;Decimal&amp;gt; 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;Double&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;Guid&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;Int16&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;Int32&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;Int64&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;Single&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Nullable&amp;lt;TimeSpan&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;Boolean&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;Byte&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;DateTime&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;Decimal&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;Double&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;Guid&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;Int16&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;Int32&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;Int64&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;SByte&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;Single&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;TimeSpan&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;UInt16&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;UInt32&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;List&amp;lt;UInt64&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;This is so
   because we have added some code to bake the data structures for these generic instantiations
   into mscorlib. Because it affects the working set of mscorlib, we couldn&amp;#8217;t do
   it for every possible combination. For generic type instantiations that take multiple
   type parameters, the rules are more complex: Roughly, when instantiating G&amp;lt;T1&amp;#8230;Tn&amp;gt;,
   where generic type G and each T in T1&amp;#8230;Tn are defined in mscorlib, at least one
   of which is a value type, you will JIT unless G&amp;lt;T1&amp;#8230;Tn&amp;gt; is found in the
   following list (note: substitute Object for any reference type parameter):&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Dictionary&amp;lt;Char,
   Object&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Dictionary&amp;lt;Int16,
   IntPtr&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Dictionary&amp;lt;Int32,
   Byte&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Dictionary&amp;lt;Int32,
   Int32&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Dictionary&amp;lt;Int32,
   Object&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Dictionary&amp;lt;IntPtr,
   Int16&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Dictionary&amp;lt;Object,
   Char&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Dictionary&amp;lt;Object,
   Guid&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;Dictionary&amp;lt;Object,
   Int32&amp;gt; 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;KeyValuePair&amp;lt;Char,
   UInt16&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: Tahoma"&gt;&lt;font color=#000000&gt;KeyValuePair&amp;lt;UInt16,
   Double&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Please notice
   that JIT will neither occur when using a custom generic type with mscorlib type arguments
   (e.g. MyType&amp;lt;int&amp;gt;), nor when using an mscorlib type with your own type arguments
   (e.g. List&amp;lt;MyStruct&amp;gt;).&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;What is described
   above is actually the worst case scenario. There are some subtleties that could result
   in a more relaxed application of these rules. Unless the coverage above has caused
   you to worry whether you might be affected, it&amp;#8217;s probably safe to skip this
   section. A more comprehensive explanation of these subtle variables follows:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Annotation
   (RicoM):&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Let A be an
   assembly, G a generic type on n parameters, T1&amp;#8230;Tn&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;A generic type
   G&amp;lt;T1,&amp;#8230;,Tn&amp;gt; shares code with type H&amp;lt;S1,&amp;#8230;,Sn&amp;gt; if and only if&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- G = H and,&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- for all i
   in [1..n] either&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- Ti = Si,
   or,&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- Ti shares
   code with Si, or,&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- both Ti and
   Si are reference types.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;------&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Assume that
   A has been NGen'd, then:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;If G is defined
   in A&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- A may use
   G&amp;lt;T1&amp;#8230;Tn&amp;gt; with no restrictions on T1&amp;#8230;Tn, no JITting is required, 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- A will include
   G&amp;lt;Object,&amp;#8230;,Object&amp;gt; even if it is not otherwise mentioned&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- The above
   two uses are present in A for other assemblies to use&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;(Remaining
   cases G not defined in A)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;If all of T1&amp;#8230;Tn
   are defined in A 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- A may use
   G&amp;lt;T1&amp;#8230;Tn&amp;gt; with no restrictions on T1&amp;#8230;Tn, no JITting is required&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- Any such
   G&amp;lt;T1&amp;#8230;Tn&amp;gt; will be present in the NGen&amp;#8217;d image of A for other assemblies
   to use&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;(Remaining
   case at least one of T1..Tn not defined in A)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;If A depends
   on assembly B and B has a type that shares code with G&amp;lt;T1&amp;#8230;Tn&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- A may use
   G&amp;lt;T1&amp;#8230;Tn&amp;gt; as found in B, no JITting is required&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- A will not
   contain code for G&amp;lt;T1&amp;#8230;Tn&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;(Remaining
   case, no match possible, this is the fallback position)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;A copy of G&amp;lt;T1&amp;#8230;Tn&amp;gt;
   will be emitted into the NGen'd code for A, this code is available for other assemblies
   to use (subject to these same rules)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;If A is loaded
   domain-specific and G, T1..Tn are all loaded from domain-neutral assemblies then 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- The CLR will
   be unable to use the copy in A and will JIT a new one&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Otherwise&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 1in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;- The copy
   of the code in A is used and there is no JITting&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;These rules
   apply transitively to all generic instantiations encountered when JITting the code
   for both the non-generic classes (which may contain generic members), and generic
   classes (which may have generic members or parameters themselves) and the &amp;#8220;seed&amp;#8221;
   &amp;lt;Object,&amp;#8230;,Object&amp;gt; instantiations in the assembly.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;In the future,
   more method sharing may be possible, but a high degree of code sharing over different
   struct type parameters is unlikely or impossible.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;Summary&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;font color=#000000&gt;In summary,
   from the performance perspective, generics are a sometimes-efficient facility that
   should be applied with great care and in moderation. When you employ a new constructed
   type formed from a pre-existing generic type, with a reference type parameter, the
   performance costs are modest but not zero. The stakes are much higher when you introduce
   new generic types and methods for use internal or external to your assembly. If used
   with value type parameters, each method you define can be quietly replicated dozens
   of times (when used across dozens of constructed types).&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;ul style="MARGIN-TOP: 0in" type=circle&gt;
   &lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: list .5in; mso-list: l3 level1 lfo3"&gt;
      &lt;font color=#000000&gt;&lt;u&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;Do&lt;/span&gt;&lt;/u&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt; use
      the pre-defined System.Collections.Generic types over reference types. Since the cost
      of each constructed type AGenericCollection&amp;lt;ReferenceType&amp;gt; is modest, it is
      appropriate to employ such types in preference to defining new strongly-typed-wrapper
      collection subtypes.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/span&gt;&lt;/font&gt; 
   &lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: list .5in; mso-list: l3 level1 lfo3"&gt;
      &lt;font color=#000000&gt;&lt;u&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;Do&lt;/span&gt;&lt;/u&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt; use
      the pre-defined System.Collections.Generic types over value types in preference to
      defining a new custom collection type. As was the case with C++ templates, there is
      currently no sharing of the compiled methods of such constructed types &amp;#8211; e.g.
      no sharing of the native code transitively compiled for the methods of List&amp;lt;MyStruct&amp;gt;
      and List&amp;lt;YourStruct&amp;gt;. Only construct these types when you are certain the savings
      in dynamic heap allocations of avoiding boxing will pay for the replicated code space
      costs.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/span&gt;&lt;/font&gt; 
   &lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: list .5in; mso-list: l3 level1 lfo3"&gt;
      &lt;font color=#000000&gt;&lt;u&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;Do&lt;/span&gt;&lt;/u&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt; use
      Nullable&amp;lt;T&amp;gt; and EventHandler&amp;lt;T&amp;gt; even over value types. We will work to
      make these two important generic types as efficient as possible.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/span&gt;&lt;/font&gt; 
   &lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt; tab-stops: list .5in; mso-list: l3 level1 lfo3"&gt;
      &lt;font color=#000000&gt;&lt;u&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;Do&lt;/span&gt;&lt;/u&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt; not
      introduce new generic types and methods without fully understanding, measuring, and
      documenting the performance ramifications of their expected use.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/span&gt;&lt;/font&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.bluebytesoftware.com/blog/aggbug.ashx?id=c310f497-6ec6-479b-b388-add078294963" /&gt;</description>
      <category>DesignGuideline;Technology</category>
    </item>
  </channel>
</rss>