Hi i need to create about 100 files in a numbered sequence like :
file1.txt,file2.txt,file3.txt .
so how can i create these files using c#.

Recommended Answers

You could use a for-loop like this:

for (int i = 0; i < NumOfFiles; i++)
            {
                Filname = "Myfilename" + i.ToString();
                // other code here
            }
Jump to Post

All 2 Replies

You could use a for-loop like this:

for (int i = 0; i < NumOfFiles; i++)
            {
                Filname = "Myfilename" + i.ToString();
                // other code here
            }

Thank you so much ddanbe for your solution

Be a part of the DaniWeb community

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