c# - Populate XML tag more than once -
the task have create xml xsd given.
i have made use of xsd.exe generate class bunch of properties in it.
one of property of return type array of class.
ex :
public class brokerconfirmation { public brokerconfirmation(); public string market { get; set; } public string schemaversion { get; set; } public string sellerparty { get; set; } public string senderid { get; set; } public brokerconfirmationtimeintervalquantity[] timeintervalquantities { get; set; } }
brokerconfirmationtimeintervalquantity class follows
public class brokerconfirmationtimeintervalquantity { public brokerconfirmationtimeintervalquantity(); public decimal contractcapacity { get; set; } public datetime deliveryenddateandtime { get; set; } public datetime deliverystartdateandtime { get; set; } public decimal price { get; set; } [xmlignore] public bool pricespecified { get; set; } }
now want display tags of brokerconfirmationtimeintervalquantity class more once .
how can achieve ?
the code have tried populate time interval qty once follows :
var data = new brokerconfirmation(); xmldocument docsave = new xmldocument(); data.timeintervalquantities = new brokerconfirmationtimeintervalquantity[] { new brokerconfirmationtimeintervalquantity { deliverystartdateandtime = convert.todatetime("2013-10-01"), deliveryenddateandtime = convert.todatetime("2013-10-30"), contractcapacity = trade.quantity, price = trade.price, pricespecified = true}; };
erm,
var data = new brokerconfirmation(); xmldocument docsave = new xmldocument(); data.timeintervalquantities = new brokerconfirmationtimeintervalquantity[] { new brokerconfirmationtimeintervalquantity {...}, // more instances here.... new brokerconfirmationtimeintervalquantity {...}, new brokerconfirmationtimeintervalquantity {...}, // etc... };
Comments
Post a Comment