C# implementation.