Port java samples to C#