Share via


Compiler Error CS0575

Only class types can contain destructors

A struct cannot contain a destructor.

The following sample generates CS0575:

// CS0575.cs
namespace x
{
   public struct iii
   {
      ~iii()   // CS0575
      {
      }

      public static void Main()
      {
      }
   }
}