score:1

Accepted answer
public class question
    {
        public int id { get; set; }
        public string questiontext { get; set; }
        public list<answer> answerlist { get; set; }
    }

    public class answer
    {
        public string text { get; set; }
        public bool iscorrect { get; set; }
    }

var results = (from x in doc.descendants("mchoice")
        select new question()
        {
            id = convert.toint16(x.element("id")),
            questiontext = x.element("question").value,
            answerlist = (x.elements("answer").select(m => new answer
            {
                text = m.value,
                iscorrect = m.attribute("correct") != null && m.attribute("correct").value == "yes"
            }).tolist())
        }).tolist();

score:1

public class  answer
{
    public string answertext { get; set; }
    public bool iscorrect { get; set; }
}

Related Query

More Query from same tag