Uploaded image for project: 'Lucene.Net'
  1. Lucene.Net
  2. LUCENENET-467 .NETify the public API where appropriate
  3. LUCENENET-468

Implement the Dispose pattern properly in classes with Close

    XMLWordPrintableJSON

    Details

      Description

      Implement the dispose pattern as suggested here on any class that implements Close(). Be sure to implement the IDisposable.Dispose() only in the base class, and have all sub-class behavior overridden in a protected method.

      This change will involve making sure that everywhere the classes are used in contrib, core, demo and test, that dispose is called on them. We don't want to neglect calling dispose in our own code. For those with Visual Studio 2010 Premium or higher, turning on Code Analysis in the project settings will flag a warning that Dispose needs to be called on a class, so you don't have to manually go searching for it.

      These changes do not have to be breaking. Instead, also make Close a public method in the base class and have it call Dispose. Mark it with the Obsolete attribute, so we can remove it in later releases.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ccurrens Christopher Calvin Currens
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1m
                  1m