枚举类型作为数据源

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace WinConst
{
    public partial class Form4 : Form
    {
        private List<Exchange> listExchange=new List<Exchange>();
        public Form4()
        {
         
 
            InitializeComponent();
            listExchange.Add(Exchange.SH);
            listExchange.Add(Exchange.BJ);
            listExchange.Add(Exchange.YL);
            listExchange.Add(Exchange.SD);
            this.cboExchange.DataSource = listExchange;
 
        }
    }
 
    enum Exchange
    {
        SH,
        BJ,
        YL,
        SD
 
    }
}
posted @ 2013-04-24 18:23  Predator  阅读(279)  评论(0编辑  收藏  举报