المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Creating a multidimensional array from class



C# Programming
06-28-2011, 10:52 AM
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 http://www.barakasoft.com/script/Forums/Images/smiley_frown.gif

Thank you for your answer