2
int countParts = 0;
List<DirectoryInfo> mydirs = new List<DirectoryInfo>();
private void _FileInformationWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
    label2.Text = e.ProgressPercentage.ToString();
    string[] test = (string[])e.UserState;
    if (test.Length > 0)
    {
        foreach (string di in test)
        {
            DirectoryInfo mydir = new DirectoryInfo(di);
            mydirs.Add(mydir);
        }
        countParts += 1;
        DirectoryInfo parts = new DirectoryInfo("Part " + countParts);
        mydirs.Add(parts);

In this case i'm adding numbers after each foreach loop. Part 1 , Part 2 , Part 3 But if I want to add Part A , Part B , Part C....in the end to start Part AA then Part AB or maybe Part A1 then Part A2 when it get to Part A10 to start Part B1 then after Part B10 to start adding Part C1 and so on.

Or maybe there something with better logic but I want to add some strings after each loop.

Rob
  • 26,989
  • 16
  • 82
  • 98
benny dayag
  • 139
  • 9
  • Well first you'd define *how* you want to count (right now you have two different options). Right out the mapping (for example `10 -> A`).. Then write code to reflect the mapping – Rob Mar 22 '16 at 23:04
  • You might choose to think of this operation as a conversion of your count to base 36 (0-9 A-Z). http://stackoverflow.com/questions/923771/quickest-way-to-convert-a-base-10-number-to-any-base-in-net – O. Jones Mar 22 '16 at 23:05
  • Possible duplicate of [Logic to generate an alphabetical sequence in C#](http://stackoverflow.com/questions/29004792/logic-to-generate-an-alphabetical-sequence-in-c-sharp) – Zohar Peled Mar 23 '16 at 06:04
  • also you could use a key/value storage – Mafii Mar 23 '16 at 08:47

2 Answers2

0

You could always try to make a 2 dimensional array and with "A" "B" "C" etc, in one of the array, and your numbers in the other array.

Remco1250
  • 85
  • 13
0

You can use the following function to generate alphabets from numbers.

Function GenerateWords(ByVal number As Integer) As String
    Dim result As String = ""
    While number > 0
        number -= 1
        result = Chr(65 + (number Mod 26)) & result
        number = number \ 26
    End While
    Return result
End Function
Pradeep Kumar
  • 6,836
  • 4
  • 21
  • 47