Porting a Java program to c#.