Try this
XDocument xDoc = XDocument.Load("path to xml");
var TagIds = xDoc.Descendants()
.Elements()
.Where(e =>
e.HasAttributes &&
e.Name.LocalName.Equals("Baseclass") &&
e.Attribute("ID") != null)
.Select(e => e.Attribute("ID").Value);
Hope this helps