public class WarrantType
{
decimal sortRank;
string warrantTypeName = string.Empty;
Hashtable warrantTypeId;
string status = string.Empty;
string warrantTypeCode = string.Empty;
decimal operators;
DateTime opTime;
}
public interface IService
{
Hashtable callMethod(Hashtable map);//查询凭证类型
} static void Main(string[] args)
{
CHessianProxyFactory factory = new CHessianProxyFactory();
string url = "http://200.187.7.23:9999/ABC/ABC/ABC";
IService test = (IService)factory.Create(typeof(IService), url);
Hashtable dict = new Hashtable();
dict.Add("method", "getWarrantType");
Hashtable result = test.callMethod(dict);
List<WarrantType> LWT = new List<WarrantType>();
foreach (DictionaryEntry DE in result)
{
ArrayList arrayList = (ArrayList)DE.Value;
for (int i = 0; i < arrayList.Count; i++)
{
WarrantType WT = (WarrantType)arrayList[i];//强制转换失败
LWT.Add(WT);
}
}
} Hashtable result = test.callMethod(dict);
result key:"result" Value: List<WarrantType> 4行每行7个属性我想得到 List<WarrantType>实例 如果转换成功,我就可以循环这个List 获取List[[i].属性得值。arrayliststringhashtable
{
decimal sortRank;
string warrantTypeName = string.Empty;
Hashtable warrantTypeId;
string status = string.Empty;
string warrantTypeCode = string.Empty;
decimal operators;
DateTime opTime;
}
public interface IService
{
Hashtable callMethod(Hashtable map);//查询凭证类型
} static void Main(string[] args)
{
CHessianProxyFactory factory = new CHessianProxyFactory();
string url = "http://200.187.7.23:9999/ABC/ABC/ABC";
IService test = (IService)factory.Create(typeof(IService), url);
Hashtable dict = new Hashtable();
dict.Add("method", "getWarrantType");
Hashtable result = test.callMethod(dict);
List<WarrantType> LWT = new List<WarrantType>();
foreach (DictionaryEntry DE in result)
{
ArrayList arrayList = (ArrayList)DE.Value;
for (int i = 0; i < arrayList.Count; i++)
{
WarrantType WT = (WarrantType)arrayList[i];//强制转换失败
LWT.Add(WT);
}
}
} Hashtable result = test.callMethod(dict);
result key:"result" Value: List<WarrantType> 4行每行7个属性我想得到 List<WarrantType>实例 如果转换成功,我就可以循环这个List 获取List[[i].属性得值。arrayliststringhashtable
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货