If you’ve got LINQ available to you, you can use Except
and Distinct
. The sets you asked for in the question are respectively:
- array2.Except(array1)
- array1.Except(array2)
- array1.Intersect(array2)
More Related Contents:
- Get maxAbs from array c# [closed]
- Determine if a number can be made with prepicked numbers and times
- All possible array initialization syntaxes
- Multidimensional Array [][] vs [,] [duplicate]
- How do I clone a range of array elements to a new array?
- printing all contents of array in C#
- Arrays, heap and stack and value types
- How do I convert struct System.Byte byte[] to a System.IO.Stream object in C#?
- Declare a const array
- Why do C# multidimensional arrays not implement IEnumerable?
- Best way to combine two or more byte arrays in C#
- How to get little endian data from big endian in c# using bitConverter.ToInt32 method?
- How to compare arrays in C#? [duplicate]
- c# Array.FindAllIndexOf which FindAll IndexOf
- JSON deserialization – Map array indices to properties with JSON.NET
- Difference between the System.Array.CopyTo() and System.Array.Clone()
- C# Creating an array of arrays
- C# Copy Array by Value
- Making an indexed control array?
- string.Join on a List or other type
- What’s the best way of creating a readonly array in C#?
- Convert from Oracle’s RAW(16) to .NET’s GUID
- How to delete an array in c#?
- Post JSON array to mvc controller
- Looking at each combination in jagged array
- How to delete a chosen element in array?
- Passing array to a SQL Server Stored Procedure
- In C#, why Equals() method on arrays only compare their references, not their actual content
- Unable to change array size in Inspector variable in Unity?
- When to use ArrayList over array[] in c#?