2011-11-22 104 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中)。

相关问题