I gang

Convert C code to C#