C# solution.