当前位置:编程学习 > C#/ASP.NET >>

调用Serializable的一些问题




[Serializable]
    [DesignerCategory("code")]
    [GeneratedCode("System.Xml", "2.0.50727.42")]
    [DebuggerStepThrough]
    public class balanceApiRequestType
    {
        public balanceApiRequestType();

        [XmlChoiceIdentifier("ItemsElementName")]
        [XmlElement("memberCode", typeof(String))]
        [XmlElement("acctType", typeof(Int32))]
        [XmlElement("memberAcctCode", typeof(String))]
        public object[] Items { get; set; }
        [XmlIgnore]
        [XmlElement("ItemsElementName")]
        public ItemsChoiceType[] ItemsElementName { get; set; }
        public string merchantMemberCode { get; set; }
    }



[Serializable]
    [GeneratedCode("System.Xml", "2.0.50727.42")]
    public enum ItemsChoiceType
    {
        acctType = 0,
        memberAcctCode = 1,
        memberCode = 2,
    }

现在问题:不知如何调用balanceApiRequestType这个类,将值赋值进去,求那位大神帮忙看看,谢谢 

我现在写的是


  baquery.balanceApiRequestType balanceApiRequestType = new baquery.balanceApiRequestType();

        Object[] ob = new Object[3];

        ob[0] = memberCode;
        ob[1] = acctType;
        ob[2] = memberAcctCode;

        baquery.ItemsChoiceType[] ItemsChoiceType = new baquery.ItemsChoiceType[3];
        ItemsChoiceType[0] = baquery.ItemsChoiceType.@acctType;
        ItemsChoiceType[1] = baquery.ItemsChoiceType.@memberAcctCode;
        ItemsChoiceType[2] = baquery.ItemsChoiceType.@memberCode;
        //ob = ItemsChoiceType;


        balanceApiRequestType.Items = ob;
        balanceApiRequestType.ItemsElementName =ItemsChoiceType;
        balanceApiRequestType.merchantMemberCode = merchantMemberCode;



错误信息:生成 XML 文档时出错。 
ItemsElementName 的值与 System.int 的类型不匹配;需要将其设置为 com.w_99bill.www.ItemsChoiceType.@acctType。 --------------------编程问答-------------------- 求大神回复。顶起来。。。。。。。。 --------------------编程问答-------------------- 看错误 acctType 应该是Int32,但是你赋的值不是数字。 --------------------编程问答--------------------
引用 2 楼  的回复:
看错误 acctType 应该是Int32,但是你赋的值不是数字。


ob[1] = acctType;
我传递的这个是一个int类型的数值,这个才是悲剧的地方。 --------------------编程问答-------------------- 顶起来,不能沉下去,求求那位帮忙下 --------------------编程问答-------------------- 顶起来,不能沉下去,求求那位帮忙下
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,