title: how to avoid duplicates of attributes in xml c#?
body: <p>A part of my XML looks like this:</p>
  
  <pre><code>&lt;IOConfig&gt;
    &lt;Packet Name="PacketOut" RemoteAddress="10.0.2.223" RemotePort="2020" NetworkInterface="ETH0"&gt;
      &lt;Signal Type="float" Name="x_out" Unit="m/s" Routing="" UnityObject="CraneBoom" UnityName="Out" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="y_out" Unit="m/s" Routing="" UnityObject="CraneBoom" UnityName="Out" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="z_out" Unit="m/s" Routing="" UnityObject="CraneBoom" UnityName="Out" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="alpha_out" Unit="m/s" Routing="" UnityObject="CraneBoom" UnityName="Out" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="theta_out" Unit="m/s" Routing="" UnityObject="CraneBoom" UnityName="Out" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="phi_out" Unit="m/s" Routing="" UnityObject="CraneBoom" UnityName="Out" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="x_out1" Unit="m/s" Routing="" UnityObject="CraneSlewing" UnityName="Out1" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="y_out1" Unit="m/s" Routing="" UnityObject="CraneSlewing" UnityName="Out1" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="z_out1" Unit="m/s" Routing="" UnityObject="CraneSlewing" UnityName="Out1" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="alpha_out1" Unit="m/s" Routing="" UnityObject="CraneSlewing" UnityName="Out1" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="theta_out1" Unit="m/s" Routing="" UnityObject="CraneSlewing" UnityName="Out1" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="phi_out1" Unit="m/s" Routing="" UnityObject="CraneSlewing" UnityName="Out1" NetworkConvert="1"&gt;&lt;/Signal&gt;
    &lt;/Packet&gt;
    &lt;Packet Name="PacketIn" LocalPort="2021" NetworkInterface="ETH0"&gt;
      &lt;Signal Type="float" Name="x_in" Unit="m/s" Routing="" UnityObject="CraneBoomCrash" UnityName="collider1" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="y_in" Unit="m/s" Routing="" UnityObject="CraneBoomCrash" UnityName="collider1" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="z_in" Unit="m/s" Routing="" UnityObject="CraneBoomCrash" UnityName="collider1" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="alpha_in" Unit="m/s" Routing="" UnityObject="CraneBoomCrash" UnityName="collider1" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="theta_in" Unit="m/s" Routing="" UnityObject="CraneBoomCrash" UnityName="collider1" NetworkConvert="1"&gt;&lt;/Signal&gt;
      &lt;Signal Type="float" Name="phi_in" Unit="m/s" Routing="" UnityObject="CraneBoomCrash" UnityName="collider1" NetworkConvert="1"&gt;&lt;/Signal&gt;
    &lt;/Packet&gt;
  &lt;/IOConfig&gt;
  </code></pre>
  
  <p>The desired output is: Out, Out1, collider1.</p>
  
  <p>That is, duplicate values of UnityName should not be printed. Can this be done?</p>
  
  <p>Code snipped that reading duplicate values of UnityName: </p>
  
  <pre><code>public class XMLStringReader : MonoBehaviour
  {
      public string slectedItem;
      private bool editing = false;
  
      public string signalsa;
      public XmlReaderSettings settings;
  
      void OnGUI ()
      {
          if ( GUILayout.Button(slectedItem))
          {
              editing = true;
          }
  
          XmlReaderSettings settings = new XmlReaderSettings();
          settings.IgnoreWhitespace = true;
          settings.IgnoreComments = true;
  
          using ( XmlReader reader = XmlReader.Create("D://Docs/Unity3D/cdp/UDPApplication/Components/UDPIOServer.xml", settings) ) 
          {
              while ( reader.Read() ) 
              {
                  if ( reader.NodeType == XmlNodeType.Element ) 
                  {
                      if ( reader.HasAttributes ) 
                      {
                          if ( reader.GetAttribute("UnityName") != null ) 
                          {
                              signalsa = reader.GetAttribute("UnityName");
                              string [] signalsCDP = {signalsa};
  
                              if (editing)
                              {
                                  for(int i =0; i &lt; signalsCDP.Length; i++) 
                                  {
                                      if (GUILayout.Button(signalsCDP[i]))
                                      {
                                          slectedItem = signalsCDP[i];
                                          editing = false;
                                          print(signalsCDP[i].ToString());
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
  }
  </code></pre>