I'm a newbie, could someone please help me what type is the "Parts", I am unable to find the correct type and hence can't return the object "Parts". Thanks
private ???? load_parts()
{
var element = XElement.Load("xml/suras.xml");
**var** Parts= from var in element.Descendants("part")
orderby var.Attribute("index").Value
select new dictSuras
{
PartIndex = Convert.ToInt32(var.Attribute("index").Value),
PartPosition = Convert.ToInt32(var.Attribute("position").Value),
PartName = var.Attribute("name").Value
};
return Parts;
}
XAttributeexplicit casting operators. For example, in doing so the line forPartIndexbecomes:PartIndex = (int)var.Attribute("index"),which is not only less code, but the code that is gone was noisy ceremonial type code, what's left is IMO meaty.