日期:2014-05-17  浏览次数:21003 次

C# winform 调用 webservice返回类型处理。
本帖最后由 wtujedp 于 2013-09-30 13:00:21 编辑
返回的类型为OBJECT具体格式如图。这个需要怎么解析。


例:我要获得 cardno对应 值。
webservice c# object

------解决方案--------------------
obj.CARDNO 取不到值吗?
------解决方案--------------------
在Watch中看OBJECT的类型是什么?强制转换过去就能访问了。
------解决方案--------------------
refer:
class Program
    {
        static void Main(string[] args)
        {
            Test test = new Test();
            test.CardNo = "877878";

            object obj = test;
            Type type = obj.GetType();
            Console.WriteLine(type.GetProperty("CardNo").GetValue(obj, null));//获得obj对象的CardNo属性值 877878
        }
    }

    public class Test
    {
        public string CardNo { get; set; }
    }