'Remove node from xml file using c#

<Events>
 <Event>
    <id>1</id>
    <title>AA</title>
    <start>2019-12-01T14:13:58.863</start>
    <end>2019-12-01T15:13:58.787</end>
    <contacts>

      <contact>
        <id>1</id>
        <name>ABC</name>
      </contact>

      <contact>
        <id>2</id>
        <name>ABCD</name>
      </contact>

      <contact>
        <id>3</id>
        <name>ABCDE</name>
      </contact>

    </contacts>
 </Event>

<Event>
    <id>2</id>
    <title>BB</title>
    <start>2019-12-01T14:13:58.863</start>
    <end>2019-12-01T15:13:58.787</end>
    <contacts>

      <contact>
        <id>1</id>
        <name>ABC</name>
      </contact>

      <contact>
        <id>2</id>
        <name>ABCD</name>
      </contact>

      <contact>
        <id>3</id>
        <name>ABCDE</name>
      </contact>

    </contacts>
 </Event>
</Events>

Above is my xml and wants to remove Event node based on id node value.So how can remove it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source