public static void Main()
<data name=""Carrier1"" xml:space=""preserve"">
<value>Carrier1Val</value>
<comment>Parameter to display Carrier 1</comment>
<data name=""Carrier2"" xml:space=""preserve"">
<value>Carrier2Val</value>
<comment>Parameter to display Carrier 2</comment>
<data name=""Employee1"" xml:space=""preserve"">
<value>Employee1Val</value>
var doc = XElement.Parse(xml);
var result = doc.Elements("data").Where(r => r.Element("comment")is not null).Count();