c# - Add list of objects to List<List<Objects>> if not contain -


i have list<list<vertex>> , vertex has property id. need add list<vertex>> list, not duplicate lists.

 public void addcomponent(list<vertex> list) {     list<list<vertex>> components = new list<list<vertex>>;      //i need       if (!components.contain(list)) components.add(list); } 

you like:

public void addcomponent(list<vertex> list) {     var isinlist = components.any(componentlist =>     {         // check equality         if (componentlist.count != list.count)             return false;          (var = 0; < componentlist.count; i++) {             if (componentlist[i] != list[i])                 return false;         }          return true;     });      if (!isinlist)         components.add(list); } 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -