c# - How to enumerate an enum

Enumerate an enum
how-to-enumerate-an-enum.aspx

<%@ Page Language="C#" AutoEventWireup="true"%>

<!DOCTYPE html>

<script runat="server">
    public enum ColorList
    { 
        Red,
        Green,
        Blue,
        Yellow,
        Maroon,
        Magenta
    }
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        foreach(var color in Enum.GetValues(typeof(ColorList)))
        {
            Label1.Text += color + " | ";
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>c# example - how to enumerate an enum</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:DarkBlue; font-style:italic;">
            how to enumerate an enum in asp.net c#
        </h2>  
        <hr width="550" align="left" color="LightBlue" />  

        <asp:Label ID="Label1" runat="server">
        </asp:Label>
        <br /><br />
        <asp:Button 
            ID="Button1" 
            runat="server" 
            Text="Enum Example" 
            OnClick="Button1_Click"
            Height="40"
            Font-Bold="true"
            />
    </div>
    </form>
</body>
</html>