Conversion to C#