//path:xml文件路徑 SECSMessage:xml文件的根元素下的第一個子集元素
<SECSLibrary>
<SECSMessage>
<Description name="hello">
hello
</Description>
</SECSMessage>
<SECSMessage>
</SECSMessage>
</SECSLibrary>
var xmlDocument = XDocument.Load(path).Root.Elements("SECSMessage");
foreach (var msg in xmlDocument)
{
msg.Element("Description").Value;
//同理,也可以獲取相應的屬性值
msg.Attribute("name“).Value;
}