c two array comparison will repeat the part removed return to the non repeated part of the implementation

  • 2021-11-14 06:41:26
  • OfStack

Examples are as follows:


List<string> Ashuzu = new List<string>();
 Ashuzu.Add("1"); 
Ashuzu.Add("2"); 
Ashuzu.Add("3");
 List<string> Bshuzu = new List<string>();
 Bshuzu.Add("1"); 
Bshuzu.Add("2"); 
Bshuzu.Add("4");
 List<string> Cshuzu = new List<string>();
 foreach (string aitem in Ashuzu)
 {
   if (!Bshuzu.Contains(aitem))
   {
     Cshuzu.Add(aitem);
   }
 }

Related articles: