Guest User

Untitled

a guest
May 4th, 2021
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Rextester
  4. {
  5.     public class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("Begin");
  10.             var item = new Item();
  11.             GC.Collect();
  12.             GC.WaitForPendingFinalizers();
  13.             Console.WriteLine("End");
  14.         }
  15.     }
  16.    
  17.     class Item: IDisposable
  18.     {
  19.         public void Dispose() => Console.WriteLine("Dispose");
  20.         ~Item() => Console.WriteLine("Finalize");
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment