0

I have this block of php that i want to convert to c# or vbnet. I am stuck on the array methods since there is no direct equal to the is array and other bits like array merge. I know that arrays behave differently in php than in c# but thats about it. 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;
  }
Ashok Padmanabhan
  • 2,110
  • 1
  • 19
  • 36

2 Answers2

0

c# has the is operator to determine data type at run time. You can use Concat to merge 2 arrays, you can use String.Split to turn a delimited string into an array. If you give more details about your inputs, we could give you more help. But this should get you close.

drdwilcox
  • 3,833
  • 17
  • 19
0

There is another question for the same topic php to C# converter.

See answers from @Stegi and @Number 9

Community
  • 1
  • 1
Vitaliy
  • 2,744
  • 1
  • 24
  • 39
  • @Vitaly I tried installing the php to asp.net migration tool but it does not install on w7 64 with .net 4, vs2010. I did load .net 1.1 but still nothing. Maybei have to load vs2003??? – Ashok Padmanabhan Nov 22 '11 at 17:59
  • Tried, and had the same issue with installation. Not sure what installers requires also (.Net 1.1) - may be VS2003 (because it has 1.1 in it). I have 2005, 2008 - but had installation error too. – Vitaliy Nov 22 '11 at 18:23
  • I tried installing the migration tool after i installed vs2003 still does not not install so my guess it will only install on xp. I'll try it on my workstation at some point - i'll need to bring up a virtual xp environment and try it – Ashok Padmanabhan Nov 23 '11 at 01:14