简体   繁体   English

php块到vbnet或C#的转换

[英]Conversion of php block to vbnet or c#

I have this block of php that i want to convert to c# or vbnet. 我有这个PHP块,我想转换为C#或vbnet。 I am stuck on the array methods since there is no direct equal to the is array and other bits like array merge. 我被困在数组方法上,因为没有直接等于is数组和其他类似array merge的位。 I know that arrays behave differently in php than in c# but thats about it. 我知道数组在php中的行为不同于在c#中,但是仅此而已。 I am looking online but have not found anything yet. 我在网上寻找,但还没有找到任何东西。 Any ideas? 有任何想法吗?

     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;
  }

c# has the is operator to determine data type at run time. c#具有is运算符,用于在运行时确定数据类型。 You can use Concat to merge 2 arrays, you can use String.Split to turn a delimited string into an array. 您可以使用Concat合并2个数组,也可以使用String.Split将定界的字符串转换为数组。 If you give more details about your inputs, we could give you more help. 如果您提供有关输入的更多详细信息,我们可以为您提供更多帮助。 But this should get you close. 但是,这应该使您接近。

There is another question for the same topic php to C# converter . 对于同一主题php至C#转换器还有另一个问题。

See answers from @Stegi and @Number 9 查看@Stegi和@Number 9的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM