C# Solution