Convert api to c#