C# Enum Finalize

In this chapter you will learn:

  1. Get to know Enum.Finalize
  2. Syntax for Enum.Finalize
  3. Returns for Enum.Finalize
  4. Example - Enum.Finalize

Description

Enum Finalize allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

Syntax

Enum.Finalize has the following syntax.


protected virtual void Finalize()

Returns

Enum.Finalize method returns

Example

The following example illustrates the use of the Finalize method.


//from   ww w  .  j  a v a2 s .  c  om
using System;

enum Mammals { Cat, Dog, Horse, Dolphin };
public class EqualsTest {
    public static void Main() {
        Mammals myPet = Mammals.Cat;
        Mammals yourPet = Mammals.Dog;

        Console.WriteLine(myPet.Finalize());

    }
}

Next chapter...

What you will learn in the next chapter:

  1. Get to know Enum.Format
  2. Syntax for Enum.Format
  3. Parameter for Enum.Format
  4. Returns for Enum.Format
  5. Example - Enum.Format