rajesh yadav

rajesh yadav

  • 1.6k
  • 82
  • 8.7k

how to compair a dictionary memeber of a class with an other

Mar 9 2020 3:49 AM
  1. public class RootObject1    
  2.     {    
  3.             
  4.         public Dictionary nodeHierarchy { getset; }    
  5.         public Dictionary Parentnode { getset; }    
  6. }    
  7. List<RootObject1> ro = new List<RootObject1>();  
  8. RootObject1 ro1 = new RootObject1  
  9. {  
  10. nodeHierarchy = new Dictionary<stringstring>  
  11. {  
  12. "l1""x" },{"l2""x" }  
  13. }  
  14. };  
  15.   
  16. ro.Add(ro1);  
  17.   
  18. Dictionary<stringstring> di = new Dictionary<stringstring>();  
  19. di.Add("l1""x");  
  20. di.Add("l2""x");  
  21.   
  22. var x = ro.Where(w => w.nodeHierarchy == di);  
  23.  // follwing is not compairing pls suggest  

Answers (1)