2011-11-22 100 views
1

我將php代碼移植到vbnet(我在vbnet上比c#好一點)。在php中是範圍解析運算符。相當於範圍解析運算符的C#或VBNET?

這裏的位:

$args = phpZenfolio::processArgs(func_get_args()); 

在C#當量/ vbnet?

整個功能如下,我相當於在vbnet中的子新。

public function __construct() 
{ 
    $args = phpZenfolio::processArgs(func_get_args()); 
    $this->APIVer = (array_key_exists('APIVer', $args)) ? $args['APIVer'] : '1.4'; 
    // Set the Application Name 
    if (! isset($args['AppName'])) { 
     throw new PhpZenfolioException('Application name missing.', -10001); 
    } 
    $this->AppName = $args['AppName']; 
    // All calls to the API are done via POST using my own constructed httpRequest class 
    $this->req = new httpRequest(); 
    $this->req->setConfig(array('adapter' => $this->adapter, 'follow_redirects' => TRUE, 'max_redirects' => 3, 'ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE, 'connect_timeout' => 5)); 
    $this->req->setHeader(array('User-Agent' => "{$this->AppName} using phpZenfolio/{$this->version}", 
            'X-Zenfolio-User-Agent' => "{$this->AppName} using phpZenfolio/{$this->version}", 
            'Content-Type' => 'application/json')); 
} 

下面是過程ARGS位:

private static function processArgs($arguments) 
{ 
    $args = array(); 
    foreach ($arguments as $arg) { 
     if (is_array($arg)) { 
      $args = array_merge($args, $arg); 
     } else { 
      if (strpos($arg, '=') !== FALSE) { 
       $exp = explode('=', $arg, 2); 
       $args[$exp[0]] = $exp[1]; 
      } else { 
       $args[] = $arg; 
      } 
     } 
    } 

    return $args; 
    } 

回答

1

你試圖調用一個static方法:

ClassName.MethodName(args); 

的方法必須被定義爲staticShared在Visual基本),並且無法訪問this(在Visual Basic中)。

相關問題