Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Creating a multidimensional array from class

Creating a multidimensional array from class

Scheduled Pinned Locked Moved C#
data-structurestutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lada_vyvojar
    wrote on last edited by
    #1

    Hello, There Service07.Eso9PortClient class that contains method getOrders () which returns an array of orders. Each order contains information (address, folders, etc.). I need to convert these orders into an array or collection so that I could browse and handle these orders. Could someone advise me how to do it? / / Order to convert the array or collection / / / / Orders Service07.Eso9PortClient orderClient07 Service07.Eso9PortClient = new (); Service07.Order [] orders = orderClient07.getOrders (); foreach (Service07.Order order in orders) { / / Order addresses Service07.Address [] addresses = order.Addresses; foreach (Service07.Address address in addresses) { / / Addresses attributes Service07.Attribute [] = addressAttributes address.Attributes; foreach (Service07.Attribute addressAttribute in addressAttributes) { string = addressAttributeName addressAttribute.Name; string = addressAttributeValue addressAttribute.Value; } string = addressCity address.City; string = addressCompany address.Company; string = addressCountry address.Country; } / / Order attributes Service07.Attribute [] = orderAttributes order.Attributes; foreach (Service07.Attribute orderAttribute in orderAttributes) { string = orderAttributeName orderAttribute.Name; string = orderAttributeValue orderAttribute.Value; } / / Order Coupon string = orderCouponCode order.Coupon! = null? order.Coupon.Code: null; string = orderCuponValue order.Coupon! = null? order.Coupon.Value: null; / / Order Created string = orderCreated order.Created; / / Order items Service07.OrderItem [] items = order.Items; foreach (Service07.OrderItem item in items) { string itemName = item.Name; string = itemNote item.Note; } } // Result should look something like this string ... myArray = new ... foreach (string in order myArray) { foreach (string address in myArray...) { .... } } Unfortunately I do not know how to declare a field and set :-( Thank you for your answer

    M 1 Reply Last reply
    0
    • L lada_vyvojar

      Hello, There Service07.Eso9PortClient class that contains method getOrders () which returns an array of orders. Each order contains information (address, folders, etc.). I need to convert these orders into an array or collection so that I could browse and handle these orders. Could someone advise me how to do it? / / Order to convert the array or collection / / / / Orders Service07.Eso9PortClient orderClient07 Service07.Eso9PortClient = new (); Service07.Order [] orders = orderClient07.getOrders (); foreach (Service07.Order order in orders) { / / Order addresses Service07.Address [] addresses = order.Addresses; foreach (Service07.Address address in addresses) { / / Addresses attributes Service07.Attribute [] = addressAttributes address.Attributes; foreach (Service07.Attribute addressAttribute in addressAttributes) { string = addressAttributeName addressAttribute.Name; string = addressAttributeValue addressAttribute.Value; } string = addressCity address.City; string = addressCompany address.Company; string = addressCountry address.Country; } / / Order attributes Service07.Attribute [] = orderAttributes order.Attributes; foreach (Service07.Attribute orderAttribute in orderAttributes) { string = orderAttributeName orderAttribute.Name; string = orderAttributeValue orderAttribute.Value; } / / Order Coupon string = orderCouponCode order.Coupon! = null? order.Coupon.Code: null; string = orderCuponValue order.Coupon! = null? order.Coupon.Value: null; / / Order Created string = orderCreated order.Created; / / Order items Service07.OrderItem [] items = order.Items; foreach (Service07.OrderItem item in items) { string itemName = item.Name; string = itemNote item.Note; } } // Result should look something like this string ... myArray = new ... foreach (string in order myArray) { foreach (string address in myArray...) { .... } } Unfortunately I do not know how to declare a field and set :-( Thank you for your answer

      M Offline
      M Offline
      Mario Majcica
      wrote on last edited by
      #2

      Please format the code properly; it is unreadable in this way and try to provide the code examples that will actually compile (and not as this string = addressAttributeName addressAttribute.Name;)!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups