Ported to C#.