Alright, my issue is that I have to create a new array with certain aspects from the old array. I know if I just make arraynew = arrayOld it would place it in the exact same place as the other one would be and that would save place.

I have to choose Managers and VIPCustomers and place them into the new array.... this is what I did

Customer[] customer = new Customer[3];
Customer[] importantCust = new Customer[3];

 customer[0] = new RegCustomer("George", 100.01, Priority.Silver);
       

   customer[1] = new VipCustomer("Hadas", 300.02, Priority.Gold);
     

   customer[2] = new Manager("Maya", 40.03, Priority.Bronze);
           
  for (int i = 0; i < customer.Length; i++)
            {
                if (TypePerson.Manager || TypePerson.Vip)
                {
                    importantCust[i] = customer[i];
                }

            }

I just don't know how to get it so if Manager or VIP goes in like 0, 1 and not 0 2 or something... or as it is, 1 , 2 and not 0, 1

please help!

Pop in a second variable to keep count in your new array.

int j = 0;
for (int i = 0; i < customer.Length; i++)
            {
                if (TypePerson.Manager || TypePerson.Vip)
                {
                    importantCust[j] = customer[i];
                     j++;
                }
commented: Thanks this is the answer. So obvious, don't know why I didn't see it +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.