.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
					
public class Program
{
	public static void Main()
	{
        int[] tab = { 1, 2, 3, 2, 1 };
        Console.WriteLine(GetSingle(tab));
	}
	
	private static int GetSingle(IEnumerable<int> tab)
    {
        return tab.Aggregate(0, (current, i) => current ^ i);
    }
}
;