Hashtable .net

虽然暂时不知道Hashtable的性能如何,但是在定义包含入参较多的方法时还是很实用的。 DataSet ds = DA.ExportData(this.getQuerConfition(), RoleSec, EMP_ID); /// /// 獲取查詢條件 /// /// private Hashtable getQuerConfition() { Hashtable arr = new Hashtable(); arr.Add("FormType",this.ddlFormType.SelectedValue);//0 表單類別 arr.Add("BFormID",this.tbBFormNo.Text.Trim());//1請款單號從 arr.Add("EFormID",this.tbEFormNo.Text.Trim());//2請款單號到 arr.Add("BBU",this.tbBBU.Text.Trim());//3公司別從 arr.Add("EBU",this.tbEBU.Text.Trim());//4公司別到 arr.Add("BStore",this.tbBStore.Text.Trim());//5店別從 arr.Add("EStore",this.tbEStore.Text.Trim());//6店別到 arr.Add("BDept", this.tbBDept.Text.Trim()); //店别从 arr.Add("EDept",this.tbEDept.Text.Trim()); //店别到 arr.Add("BApplyDate", this.tbBApplyDate.SelectedDate.ToString("yyyy-MM-dd"));//7申請日期從 arr.Add("EApplyDate", this.tbEApplyDate.SelectedDate.ToString("yyyy-MM-dd"));//8申請日期到 arr.Add("BSubject",this.tbBSubject.Text.Trim());//9會計科目從 arr.Add("ESubject",this.tbESubject.Text.Trim()); string value = ""; for (int i = 0; i < cbYorN.Items.Count; i++) { if (cbYorN.Items[i].Selected == true) { value += cbYorN.Items[i].Value + "|"; } } arr.Add("YorN",value.TrimEnd('|')); return arr; } public DataSet ExportData(Hashtable hs, string RoleSec, string empid) { //表單單號 if (hs["BFormID"].ToString() != string.Empty) { sql1 += " AND main.FORM_ID>='" + hs["BFormID"].ToString() + "'"; } } Hashtable hsFORM_NO = new Hashtable(); object[] arr = new object[2]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { form_no = Convert.ToInt32(ds.Tables[0].Rows[i]["FORM_NO"]); if (!hsFORM_NO.ContainsValue(form_no)) { hsFORM_NO.Add(i, form_no); arr = new object[2];//释放资源
原文地址:https://www.cnblogs.com/Chinarain/p/4277429.html