XML to C# Class Question

前端 未结 7 1285
走了就别回头了
走了就别回头了 2020-12-17 01:07

Can someone please help me, I have this xml snippet



  123         


        
7条回答
  •  北海茫月
    2020-12-17 01:20

    This class will serialize the way you want. I changed your custom collection to a List and used the XmlArrayItem attribute to specify how each email address would be serialized. There are many such attributes to help you fine tune the serialization process.

    [Serializable]
    public class EmailConfiguration {
        private string dataBoxID;
        public string DataBoxID {
            get { return dataBoxID; }
            set { dataBoxID = value; }
        }
    
        private List defaultSendToAddressCollection;
    
        [XmlArrayItem("EmailAddress")]
        public List DefaultSendToAddressCollection {
            get { return defaultSendToAddressCollection; }
            set { defaultSendToAddressCollection = value; }
        }
    
        public EmailConfiguration() {
            DefaultSendToAddressCollection = new List();
        }
    }
    

提交回复
热议问题