いまこんな感じ。 var query = from person in xdoc.Root.Elements() select new{ Name = person.Attribute("name").Value, Age = (int)person.Attribute("Age") > 38 }; contents = ""; foreach (var q in query) if (q.Name.Contains("坂本")) contents += q.Name + "\t" + q.Age + "\r\n";