c# implementation