webservice中不支持hashtable的數(shù)據(jù)類型,那么如何在webservice中傳遞hashtable呢?我們可以通過將hashtable轉化為webservice中支持的數(shù)組的類型來進行傳遞,在調用的時候再轉換成hashtable就可以了。
轉載:http://www.companysz.com/emperoryong/archive/2009/09/13/1565902.html
1: [WebMethod]
2: public DictionaryEntry[] SetValue()
3: {
4: Hashtable sl = new Hashtable();
5: sl.Add("kiss", "me");
6: sl.Add("love", "you");
7: DictionaryEntry[] array = new DictionaryEntry[sl.Count];
8: sl.CopyTo(array, 0);
9: return array;
10: }
調用webservice中的方法
1: using System;
2: using System.Data;
3: using System.Configuration;
4: using System.Web;
5: using System.Web.Security;
6: using System.Web.UI;
7: using System.Web.UI.WebControls;<PRe style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; bord
|
新聞熱點
疑難解答