Click here to Skip to main content
15,908,445 members
Home / Discussions / C#
   

C#

 
GeneralRe: DateTime Hour Minute Question [modified] Pin
#realJSOP4-May-08 3:53
professional#realJSOP4-May-08 3:53 
It takes a little time to create a file, but the time it takes is enough to pretty much guarantee a unique name every time, especially if your code is performing exception handling (which it should), and properly closing the file (which it should). If you include the millisecond portion of the date time, you should be good to go. Besides, if you think there's a chance of it, the simple solution is to insert the line Thread.Sleep(25); just before you create the file. Doing so guarantees a unique filename using the date/time naming method, and it will introduce unnoticeable latency in your code.

If you don't really care what the file name is as long as it's unique, use a GUID for the name. A GUID is guaranteed to be unique no matter how many you create in a given second.


"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


modified on Sunday, May 4, 2008 10:04 AM

GeneralRe: DateTime Hour Minute Question Pin
PIEBALDconsult4-May-08 5:55
mvePIEBALDconsult4-May-08 5:55 
GeneralRe: DateTime Hour Minute Question Pin
Luc Pattyn4-May-08 11:40
sitebuilderLuc Pattyn4-May-08 11:40 
QuestionCPU and RAM Usage Pin
Ian Uy3-May-08 19:44
Ian Uy3-May-08 19:44 
AnswerRe: CPU and RAM Usage Pin
MumbleB3-May-08 22:13
MumbleB3-May-08 22:13 
QuestionOutput to word? Pin
Muammar©3-May-08 19:40
Muammar©3-May-08 19:40 
AnswerRe: Output to word? Pin
MumbleB3-May-08 22:21
MumbleB3-May-08 22:21 
GeneralRe: Output to word? Pin
Muammar©3-May-08 23:05
Muammar©3-May-08 23:05 
Questionabout desktop.ini. [modified] Pin
Prabhat0033-May-08 18:55
Prabhat0033-May-08 18:55 
AnswerRe: about desktop.ini. Pin
Muammar©3-May-08 19:49
Muammar©3-May-08 19:49 
GeneralRe: about autorun.ini. Pin
Prabhat0033-May-08 20:18
Prabhat0033-May-08 20:18 
GeneralRe: about autorun.ini. Pin
Muammar©3-May-08 20:21
Muammar©3-May-08 20:21 
QuestionControl media player with C# Pin
BobbyWhiskey3-May-08 18:16
BobbyWhiskey3-May-08 18:16 
QuestionRiemer's code Pin
sakirah3-May-08 14:28
sakirah3-May-08 14:28 
AnswerRe: Riemer's code Pin
Christian Graus3-May-08 15:11
protectorChristian Graus3-May-08 15:11 
AnswerRe: Riemer's code Pin
MarkB7774-May-08 0:22
MarkB7774-May-08 0:22 
QuestionUrgent please Pin
Sahar1113-May-08 11:51
Sahar1113-May-08 11:51 
AnswerRe: Urgent please Pin
Oakman3-May-08 12:13
Oakman3-May-08 12:13 
AnswerRe: Urgent please Pin
Christian Graus3-May-08 12:39
protectorChristian Graus3-May-08 12:39 
AnswerRe: Urgent please Pin
Paul Conrad3-May-08 12:57
professionalPaul Conrad3-May-08 12:57 
QuestionHow to develop virtual environment online using C# with Managed DirectX? (in 3D) Pin
katelva3-May-08 8:23
katelva3-May-08 8:23 
AnswerRe: How to develop virtual environment online using C# with Managed DirectX? (in 3D) Pin
carbon_golem3-May-08 9:46
carbon_golem3-May-08 9:46 
GeneralRe: How to develop virtual environment online using C# with Managed DirectX? (in 3D) Pin
katelva3-May-08 16:29
katelva3-May-08 16:29 
GeneralRe: How to develop virtual environment online using C# with Managed DirectX? (in 3D) Pin
carbon_golem3-May-08 16:37
carbon_golem3-May-08 16:37 
Questionloading a list from a data file Pin
Jerry Graham3-May-08 8:04
Jerry Graham3-May-08 8:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.