这就是我在做什么。
[XmlType将( “RepaymentSchedule”)]
[XmlType("RepaymentSchedule")]
public class APIRepaymentSchedule
{
[XmlArray("ItemList")]
public List<APIRepaymentScheduleDetails> RepaymentScheduleDetails;
}
[XmlType("RepaymentScheduleDetails")]
public class APIRepaymentScheduleDetails
{
public Decimal? EscrowPayment { get; set; }
[XmlElement("Payment")]
public string _Payment { get; set; }
[XmlIgnore]
public Decimal? Payment
{
get
{
if (!string.IsNullOrWhiteSpace(_Payment))
return Decimal.Parse(_Payment);
return null;
}
set { }
}
}
De-Serailize XML:
public static APIOutstandingResponseDetail ParseGetOutstandingXML(string custxml)
{
APIOutstandingResponseDetail OutstandingDetails;
XmlSerializer serializer = new XmlSerializer(typeof(APIOutstandingResponseDetail), new XmlRootAttribute("OutstandingResponseDetail"));
using (TextReader rdr = new StringReader(custxml))
{
OutstandingDetails = (APIOutstandingResponseDetail)serializer.Deserialize(rdr);
}
return OutstandingDetails;
}
APIRepaymentSchedule
是APIOutstandingResponseDetail
我能够将所有XML字段值读入类变量。
以下是问题:
我正在对其中一个字段进行一些计算。我们说Payment
。我想在读取XML文件后设置Payment值。
var responseObj = new APIRepaymentSchedule();
responseObj.RepaymentScheduleDetails[index].Payment = /* Set Some Value Here*/;
Payment
字段?任何的想法。它保留了XML中的旧值。 我试过了:
set { Payment = value; }
它给出了StackOverflow异常
答案 0 :(得分:1)
将您的托管属性的设置者更改为将设置它的人,例如:
window.location.replace