HybridDictionary简单小例子

namespace CDR.components
{
 /// <summary>
 /// CallerType 的摘要说明。
 /// </summary>
 public enum CallerType
 {
  Call = 1,
  Relay,
  SoftSwitch
 }

 public class CallerTypes
 {
  public static HybridDictionary types = new  HybridDictionary();
  
  static CallerTypes()
  {
   types[CallerType.Call] = "主叫";
   types[CallerType.Relay] = "中继";
   types[CallerType.SoftSwitch] = "软交换";
  }

  public static HybridDictionary Types
  {
   get{return types;}
  }
 }
}

  private void Page_Load(object sender, System.EventArgs e)
  {
   // 在此处放置用户代码以初始化页面
   if(!IsPostBack)
   {
    BindCallerType(txtCallerTypeID);
   }
  }

  private void BindCallerType(DropDownList ddl)
  {
   try
   {
    ddl.Items.Clear();
    ddl.DataSource = CallerTypes.types.Values;
    ddl.DataBind();
   }
   catch
   {}
  }

你可能感兴趣的:(IO)