how to Check if a XML child element exists with Linq to XML

c#, linq-to-xml, xml

Solution

bool b = xdocument.Descendants("IncomingConfig").Any();

Problem

How can I check if `IncomingConfig` element exists by use linq to xml? ``` <?xml version="1.0" encoding="utf-8"?> <settings> <IncomingConfig> <ip>10.100.101.18</ip> <port>5060</port> </IncomingConfig> <Device> <username>tarek</username> <AgentName>tarek</AgentName> <password>ffff</password> </Device> <Device> <username>adf</username> <AgentName>adf</AgentName> <password>fadsf</password> </Device> </settings> ```

Original source