Creates a disposable class

    0

    13

    lucycodes42

    C# recipes

    This code is from a class that implements IDisposable. When the class is disposed of, the GC will suppress the finalizer for this class.

    Shortcut: classd

    public class MyClass : IDisposable
    {
    
      public void Dispose()
      {
        GC.SuppressFinalize(this);
      }
    
      
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.