Enum.ToString() is returning default value instead of specified value

Enum.ToString() is returning default value instead of specified value

I am trying to write a game, and I am using an enum to store colors of paint. The enum keeps returning the default value instead of the value of the field. Is there a way to prevent this?

I am trying to write a game, and I am using an enum to store colors of paint. The enum keeps returning the default value instead of the value of the field. Is there a way to prevent this?

This is a C# .NET Forms application, for .NET Framework 4.6.1.

Here is my code:

public enum PaintColor
{
    Red,
    Orange,
    Yellow,
    Green,
    Blue
}
class Form1 : Form
{

private void Form1_Load(Object sender, EventArgs e)
{
    PaintBucket orange = new PaintBucket()
    {
        Color = PaintColor.Orange,
        Amount = 22
    };
    Label OrangeContent = new Label
    {
        Text = (orange.ToString()),
        Width = 100,
        Height = 20,
        Top = 500,
        Left = 500
    };
}

}

and then the overriden ToString method inside the PaintBucket class:

public override string ToString()
{
    return (this.Color.ToString() + ", " + this.Amount.ToString());
}

As you can see above, the field orange contains an orange PaintBucket. The label OrangeContent, contains orange.ToString. But it shows up as Red, 0 instead of Orange, 22. Red is the default value of the enum, and 0 is the default value for the integer. Is there a way to return the value of the fields instead of the default?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Variable Introduction in C#[Bangla]

LIKE | COMMENT | SHARE | SUBSCRIBE A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C# has a speci...

Taking Input From User In C#[Bangla]

LIKE | COMMENT | SHARE | SUBSCRIBE In C#, the simplest method to get input from the user is by using the ReadLine() method of the Console class. However, Rea...