Search code examples
c#windowsdevelopment-environment

Subtracting one arrayList from another arrayList using C#


I need Subtracting one arrayList from another arrayList using c#. Help me please


Solution

  • You can use LINQ for all enumerable manipulations:

    var a = new []{1,2,3,4,5};
    var b = new []{    3,4,5,6,7,8};
    
    var res = a.Except(b).ToList();
    //res: 1,2