0
我知道如何從XML文件中讀取內容,但我不知道如何寫入內容。如何將整數變量保存到XML文件?
例如,我從XML文件中讀取整數變量並對其進行修改。修改後,我想將整型變量保存到同一個XML文件中。舊的整數值必須用新值替換。我的遊戲在Windows 7
運行我加載XML文件與此代碼:
protected override void LoadContent()
{
scorexml = Content.Load<List<Gamescore>>("Score");
foreach (Gamescore score in scorexml)
{
score.Load(Content);
}
}
public class Gamescore
{
int score;
public int Score
{
get { return score; }
set { score = value; }
}
}
什麼是「內容」? – 2012-07-16 13:29:16
檢查這 http://stackoverflow.com/questions/367730/how-to-change-xml-value-file-using-c-sharp 如果它適合你,我會張貼它作爲答案! – 2012-07-16 13:29:33
@ DanielA.White這是XNA加載遊戲資產的類。 – Tharwen 2012-07-16 13:30:43