Apr 22, 2004 #1 K Keith_boys New member Joined Apr 22, 2004 Messages 2 Does anyone know how to redimmension arrays in J#? im trying to translate from c to j and its not working. id appreciate any help. thanks.
Does anyone know how to redimmension arrays in J#? im trying to translate from c to j and its not working. id appreciate any help. thanks.
Apr 22, 2004 #2 Iceplug Well-known member Joined Aug 20, 2001 Messages 706 Location South Carolina, USA I dont know if theres a prettier way to do this, but you can create a new array and assign the elements from the old into the new. Code: [COLOR=DarkSlateBlue]int[/COLOR] sectou[] = {10, 20, 30, 40, 50, 60}; [COLOR=DarkOrchid]// Old array above, new array below.[/COLOR] [COLOR=DarkSlateBlue]int[/COLOR] sector[] = [COLOR=DarkSlateBlue]new int[/COLOR][7]; System.Array.Copy(sectou, 0, sector, 0, 6); [COLOR=DarkOrchid]// Copies in the old elements.[/COLOR] If you only want a bigger array, the new int[##] part should work for you.
I dont know if theres a prettier way to do this, but you can create a new array and assign the elements from the old into the new. Code: [COLOR=DarkSlateBlue]int[/COLOR] sectou[] = {10, 20, 30, 40, 50, 60}; [COLOR=DarkOrchid]// Old array above, new array below.[/COLOR] [COLOR=DarkSlateBlue]int[/COLOR] sector[] = [COLOR=DarkSlateBlue]new int[/COLOR][7]; System.Array.Copy(sectou, 0, sector, 0, 6); [COLOR=DarkOrchid]// Copies in the old elements.[/COLOR] If you only want a bigger array, the new int[##] part should work for you.
Apr 23, 2004 #3 K Keith_boys New member Joined Apr 22, 2004 Messages 2 its public thanks for the suggestion, but the problem with that, is that the array im trying to redimension is public.
its public thanks for the suggestion, but the problem with that, is that the array im trying to redimension is public.
Apr 23, 2004 #4 Iceplug Well-known member Joined Aug 20, 2001 Messages 706 Location South Carolina, USA Oh, then just swap them at the end: sectou = sector .