询问者
windows mobile 5 读取webservice传过来的DictionaryEntry[]

常规讨论
-
PDA通过webservice获取DictionaryEntry[]数组,里面是我自定义的类型,普通的桌面应用程序可以正常获取,而且里面的类型也是正常的,但是在windows mobile5 环境下,得到的DictionaryEntry[]里面的类型是Object,而且无法强制转换成我需要的自定义类型,不知道是怎么回事,希望大家帮忙看看~~
Webservice的代码大概如下
[WebMethod]
public global::ItemSync[] SearchNeedSyncItems(String para)
{
Hashtable sl = new Hashtable();
ItemSync[] itemsyncs = GetItemSync(para);//自定义类型
foreach (ItemSync isync in itemsyncs)
{
Item item = GetItem(isync.id);//自定义类型
sl.Add(isync, item);
}
DictionaryEntry[] array = new DictionaryEntry[sl.Count];
sl.CopyTo(array, 0);
return array;
}PDA端的代码大概如下
DictionaryEntry[] syncs = syncservice.SearchSyncItems(syncdate);
奇怪的就是同样的代码,在普通的windows应用程序中正常,但是windows mobile 环境下就不行了。- 已更改类型 Jiong ShiMVP, Moderator 2011年3月10日 14:31
全部回复
-
webservice的代码贴错了
[WebMethod] public DictionaryEntry[] SearchSyncItems(String para) { Hashtable sl = new Hashtable(); ItemSync[] itemsyncs = GetItemSync(para);//自定义类型 foreach (ItemSync isync in itemsyncs) { Item item = GetItem(isync.id);//自定义类型 sl.Add(isync, item); } DictionaryEntry[] array = new DictionaryEntry[sl.Count]; sl.CopyTo(array, 0); return array; }