Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:13:36+00:00 2026-06-07T17:13:36+00:00

I am a c# guy and working with an api where all examples are

  • 0

I am a c# guy and working with an api where all examples are in php so i need help so i can understand what is this code exactly

$rooms = array();

     // First Room
     $rooms[] = array(array("paxType" => "Adult"));

     // Second Room
     $rooms[] = array(array("paxType" => "Adult"), array("paxType" => "Adult"), array("paxType" => "Child", "age" => 8));

I need if anybody can describe this code to me as i am c# guy.

As i am google around this so this is a multidimensional array that i already understand

and pax is class in this api (as per api documentation) which have some properties like paxtype,age etc…..

but i am not getting the way to right this in c#.

Edit

that pax type multidimensional array passed to this method

public getAvailableHotelResponse getAvailableHotel(string apiKey, string destinationId, DateTime checkIn, DateTime checkOut, string currency, string clientNationality, bool onRequest, pax[][] rooms, filter[] filters);

2nd EDIT

public getAvailableHotelResponse getAvailableHotel(string apiKey, string destinationId, DateTime checkIn, DateTime checkOut, string currency, string clientNationality, bool onRequest, pax[][] rooms, filter[] filters);

I have to pass this pax[][] rooms in my method and rooms will have the following structure

rooms[0][0][paxType]=Adult
rooms[0][1][paxType]=Adult
rooms[0][2][paxType]=Child
rooms[0][2][age]=6


rooms[1][0][paxType]=Adult
rooms[1][1][paxType]=Adult
rooms[1][2][paxType]=Child
rooms[1][2][age]=8

and the pax class is below

 public class pax
    {
        public pax();

        [SoapElement(DataType = "integer")]
        public string age { get; set; }
        public string firstName { get; set; }
        public string lastName { get; set; }
        public string paxType { get; set; }
        public string title { get; set; }
    }

I think its now much clearer to us all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:13:38+00:00Added an answer on June 7, 2026 at 5:13 pm

    Arrays are dynamic in PHP. Since one cannot determine the size, translating it to C# will require a non-primitive array.

    // $rooms = array ();
    List<List<pax>> rooms = new List<List<pax>>();
    

    The ff PHP code,

    $rooms[] = array (array ("paxType" => "Adult"));
    

    can also be interpreted as:

    $room = array ();
    $pax = array ();
    $pax["paxType"] = "Adult";
    $room[] = $pax;
    $rooms[] = $room;
    

    Hence,

    // $room = array ();
    List<pax> room = new List<pax>();
    
    // $pax = array ();
    pax p = new pax();
    
    // $pax["paxType"] = "Adult";
    p.paxType = "Adult";
    
    // $room[] = $pax;
    room.Add(p);
    
    // $rooms[] = $room;
    rooms.Add(room);
    

    Then just convert it to a primitive array.

    // this will be the pax type array
    pax[][] paxRooms = new pax[rooms.count][];
    for (int i = 0; i < rooms.Count; i++) {
        paxRooms[i][] = rooms[i].ToArray();
    }
    

    P.S. I’m a PHP/Java guy so excuse me for syntax errs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If anyone can get this guy's small bit of code working on their machine,
This is a nasty one for me... I'm a PHP guy working in Java
I'm a LAMP guy and ended up working this small news module for an
Guy, I am in need for a functionality which can take Zipcode as an
Help a guy out. Can't seem to get a decorator to work with inheritance.
I am currently working on a building community website in PHP. This contains forms
Just started working on a c project. Need help with passing function pointers/macro functions/etc.
Working on existing code, I recently found smt like this: if(Config.ExceptionBehavior.DEBUG_EXCEPTIONS) { foo.Foo(); }
I have this working code for animating drawing a line in Raphael JS: var
I'm primarily a Ruby guy, but lately I've been working on a lot of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.