Question: I have an enum that I'd like to display all possible values of. Is there a way to get an array or list of all the possible values of the enum instead of manually creating such a list? e.g. If I have an enum:

```
public enum Enumnum { TypeA, TypeB, TypeC, TypeD }

```

how would I be able to get a `List<Enumnum>` that contains `{ TypeA, TypeB, TypeC, TypeD }`?

Answer: 
This is way easier now with the generic method in .NET 5.0.

```
ColorEnum[] colors = Enum.GetValues<ColorEnum>();

```

[MS Doc: Enum.GetValues](https://learn.microsoft.com/en-us/dotnet/api/system.enum.getvalues?view=net-5.0#System_Enum_GetValues__1)
The OP asked for How to get an array of all `enum` values in C# ?

**What if you want to get an array of selected `enum` values in C# ?**

**Your Enum**

```
    enum WeekDays 
    {
        Sunday, 
        Monday,
        Tuesday
    }

```

If you want to just select `Sunday` from your `Enum`.

```
  WeekDays[] weekDaysArray1 = new WeekDays[] { WeekDays.Sunday };

  WeekDays[] weekDaysArray2 = Enum.GetValues(typeof(WeekDays)).Cast<WeekDays>().Where
  (x => x == WeekDays.Sunday).ToArray();

```

Credits goes to knowledgeable tl.

References:

[1.](https://stackoverflow.com/questions/3160267/how-to-create-an-array-of-enums)

[2.](https://stackoverflow.com/questions/17123548/convert-enum-to-list)

Hope helps someone.