Changing C++ to C#