Please try this.
System.Xml.Linq.XDocument objDoc = System.Xml.Linq.XDocument.Load(HttpContext.Server.MapPath("XMLFile.xml"));
var objCases = (from C in objDoc.Descendants("Case")
where C.Attribute("Compartment").Value == "1"
select C.Attribute("Id").Value).ToList();
foreach (var Ids in objCases)
{
Console.WriteLine(Ids);
}
And if you want to select all Case Node then you can use this
var objCases = (from C in objDoc.Descendants("Case")
where C.Attribute("Compartment").Value == "1"
select C).ToList();