Skip to content
Loading
+4
  • +4
    The last array in array list only append to the X.I want to create X1,X2,X3 arrays and append that three arrays from Arraylist @
    Chetan Ranpariya
    +4
  • +4
    Can you please explain more about  what the function doing? @
    Suthish Nair
    +4
  • +4
    Dinesh,
     
    You can not generate the variable names at runtime like X1, X2 and so on.
     
    Here you have obj, which is Array of Arrays.
    Instead of creating another array out of it why don't you use it directly where ever you want to use it? As following. 
    1. for (var i = 0; i < obj.length; i++) {    
    2.     var arr = obj[1];  
    3.     //do looping with arr to access its values  
    4.     for(var j = 0; j< arr.length;j++)  
    5.     {  
    6.         //use arr[i] to do whaterver you want...  
    7.     }  
    8. }  
    I hope this will help you.
     
    This is a simple logic.
     
    Thanks and regards,
    Chetan Ranpariya
    [No programming language is helpful if logic is not clear] 
    +4
  • +4
    Thanks for your guidance.@
    Chetan Ranpariya
    +4
  • Bikesh Srivastava
    +4
    i think best option is use foreach loop and store one by one in separte array.
    +4
  • Khaja Moizuddin
    +4
    Try this https://msdn.microsoft.com/en-us/library/fcyyh2hb(v=vs.110).aspx https://www.dotnetperls.com/convert-arraylist-array http://stackoverflow.com/questions/8924869/how-to-convert-arraylist-into-string-arraystring-in-c-sharp hope this helps
    +4