PHP服务调用转换为C#

I have been given this API which is based in PHP but I need to convert it into C#. This is only the first method and this is my result. I seem to be missing a lot. Will this c# method function as the PHP ones does

PHP:

// Call SVP Service
function callSVPService($service, $arg, $raw_data = false) {
    global $entry_point;

    $count_attempts = 3;
    $token_error_codes = array(2004, 2005, 2006);
    $counter = 0;
    // Make a attempts to call a SVP API service.
    // With this we can automatically generate a new token if the token is empty,
    // the token is not valid or the validation period of the token is expired.
    while(true) {
        $counter++;
        $token_response = getToken();
        // If token error occurs - exit calling service.
        if($token_response['error_code']) {
            return array('error_code' => $token_response['error_code'], 'response' => '');
        }
        $token = $token_response['token'];
        $arg['token'] = $token;

        $response = callSVP_API_Service($service, $arg);
        $result = getTextBetweenTags($response, 'result', true);

        if(!$result) {
            if(!$raw_data) {
                return array('error_code' => -1, 'response' => $response);
            }
            else if(!$response) {
                return array('error_code' => -1, 'response' => 'Empty server response');
            }
            else {
                $error_code = 0;
            }
        }
        else if($result == 'ERROR') {
            $error_code = getTextBetweenTags($response, 'code', true);
        }
        else if($result == 'OK') {
            $error_code = 0;
        }

        if(!$error_code) {
            return array('error_code' => 0, 'response' => $response);
        }
        else if(in_array($error_code, $token_error_codes)) {
            // The service response contains a token error. Try to generate a new token.
            saveToken(0);
        }

        if($counter >= $count_attempts) {
            return array('error_code' => $error_code, 'response' => $response);
        }
    }
}

C#

public dynamic callSVPService(dynamic service, dynamic arg, dynamic raw_data)
        {
            var countAttempt = 3;
            int[] tokenErrorCodes;
            tokenErrorCodes = new int[2004];
            tokenErrorCodes = new int[2005];
            tokenErrorCodes = new int[2006];
            var counter = 0;

            while (true)
            {
                counter++;
                var tokenResponse = getToken();
                var token = tokenResponse["token"];

                var response = callSVPAPIService(service, arg);
                var result = getTextBetweenTags(response, "result", true);

                return result;
            }
        }