Added C# reference implemenation