B
Brett
I need to create unique file names while in a loop. Each interaction will
produce a file name. Also, there may be 10 threads, each with its own loop
producing files, all going at the same time. The files are actually images
being created by a special printer driver.
I thought using a long date would be good. However, I can't find how to
include milliseconds, which is critical. This is the closest I could find:
System.DateTime.Now.Millisecond. Also, I will need to append a random
number to the date, which should ensure uniqueness.
I want to remove all spaces, semicolons, and slashes. This means three
lines of code to perform a Replace() on the same variable. Is there another
way to do this?
Any comments on a completely different approach to producing these unique
names is welcome. Dates aren't necessary. I wasn't sure if a random number
has the probability of coming up again at some point. That's why I chose a
mixture of date and random number.
Thanks,
Brett
produce a file name. Also, there may be 10 threads, each with its own loop
producing files, all going at the same time. The files are actually images
being created by a special printer driver.
I thought using a long date would be good. However, I can't find how to
include milliseconds, which is critical. This is the closest I could find:
System.DateTime.Now.Millisecond. Also, I will need to append a random
number to the date, which should ensure uniqueness.
I want to remove all spaces, semicolons, and slashes. This means three
lines of code to perform a Replace() on the same variable. Is there another
way to do this?
Any comments on a completely different approach to producing these unique
names is welcome. Dates aren't necessary. I wasn't sure if a random number
has the probability of coming up again at some point. That's why I chose a
mixture of date and random number.
Thanks,
Brett