question
C# を使用してとの値を取得したいのですanswer
が、その前に必要な ID を取得したいと考えています。私はこのXMLを使用しています:
<root>
<information>
<name>Tasks</name>
<date>15-05-2005</date>
</information>
<tasks>
<task>
<id>1</id>
<question>Here comes question 1</question>
<answer>Answer 1</answer>
</task>
<task>
<id>2</id>
<question>Here comes question 2</question>
<answer>Answer 2</answer>
</task>
<task>
<id>3</id>
<question>Here comes question 3</question>
<answer>Answer 3</answer>
</task>
</root>
C# コード:
XDocument tasks;
int TheIdINeed = 2;
string quest = "";
string answ = "";
フォームのロード時:
tasks = XDocument.Load(leveltoload);
var status = tasks.Element("level").Element("information");
quest = tasks.Element("root").Element("tasks").Element("task").Element("question").Value; // It returns me the first task data, but I need to load data with required Id (int TheIdINeed = ...)
すみません、私の英語はうまくありません。