When I run the code below, it out puts the "uname" and "type" attribute values for all entries in the XML with type="Troop" to dataGridView1. What I want it to do is to just output the "uname" value and not the "type" value. Any ideas? I have already tried replacing unitType.Add(Unit); with unitType.Add(Unit.uname); but then it just output the length of the name and nothing else. I just started teaching myself C# a few days ago, so I thank you VERY much for any help.

var Units = from Unit in document.Descendants("Unit")

select new
{
type = Unit.Attribute("type").Value,
uname = Unit.Attribute("uname").Value,

};

var filteredUnits = from Unit in Units
where Unit.type == "Troop"
select Unit;



BindingSource unitType = new BindingSource();
foreach (var Unit in filteredUnits)
unitType.Add(Unit);


dataGridView1.DataSource = unitType;