Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

You will be very much thankful if you solve the below problem.
i have 1000 files in an array.i want to process the first 500 files.after that next 500 files i want to process.

Now my problem was, is there any possibility to split the array based on index?
or else can we copy the remaining 500 to next array?


Thanks & Regards
Jai
Posted
Updated 15-Mar-13 1:25am
v2

1 solution

Hi jai,

try this

C#
//temp class ading to list ( you can create List<string> like this;
List<TestClass> ListDevLog = new List<TestClass>();
//this is array type like string[]
        TestClass[] objDevLogArry;

//if count more than 500
        if (ListDevLog.Count > 500)
        {
//then devided by 500 ( so here spilt in to 2 parts)
            double temp = Math.Floor(Convert.ToDouble(ListDevLog.Count / 500));
//this is loop based on temp count
            for (int i = 0; i < temp; i++)
            {
//here you can process you 500 files
//after completing your 500 files process.. just remove those files from list
                ListDevLog.RemoveRange(0, 500);
            }
        }


you can convert c# code to vb code in www.developerfusion.comsite
 
Share this answer
 
v3
Comments
jai_mca 15-Mar-13 7:26am    
thanks Bojjaiah.can you please explain it ?
Bojjaiah 15-Mar-13 7:35am    
First of all devide the or split the files by 500
then for loop first 5oo files are process after complete I just remove those files and next time remaining files are process........... ok.
jai_mca 15-Mar-13 7:37am    
k Bojjaiah..understood.instead of remove the processed file,can we move it to another array for future work?
Bojjaiah 15-Mar-13 7:42am    
after completing 500 files processing.. I just remove those files from list.
see updated my answer.
jai_mca 15-Mar-13 7:44am    
yeah..instead of remove it,how to copy to another?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900