Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/Symmetric-difference/C-sharp/symmetric-difference.cs
Normal file
28
Task/Symmetric-difference/C-sharp/symmetric-difference.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace RosettaCode.SymmetricDifference
|
||||
{
|
||||
public static class IEnumerableExtension
|
||||
{
|
||||
public static IEnumerable<T> SymmetricDifference<T>(this IEnumerable<T> @this, IEnumerable<T> that)
|
||||
{
|
||||
return @this.Except(that).Concat(that.Except(@this));
|
||||
}
|
||||
}
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
var a = new[] { "John", "Bob", "Mary", "Serena" };
|
||||
var b = new[] { "Jim", "Mary", "John", "Bob" };
|
||||
|
||||
foreach (var element in a.SymmetricDifference(b))
|
||||
{
|
||||
Console.WriteLine(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue