Added C# implementation.