Click here to Skip to main content
15,898,374 members
Home / Discussions / C#
   

C#

 
GeneralRe: compile time error or runtime error? Pin
Guffa5-May-08 10:33
Guffa5-May-08 10:33 
GeneralRe: compile time error or runtime error? Pin
George_George7-May-08 1:29
George_George7-May-08 1:29 
AnswerRe: compile time error or runtime error? Pin
Charith Jayasundara4-May-08 8:04
Charith Jayasundara4-May-08 8:04 
GeneralRe: compile time error or runtime error? Pin
George_George4-May-08 18:46
George_George4-May-08 18:46 
QuestionNumbers Don't Display According To The Current Culture! Pin
WaleedH3-May-08 23:21
WaleedH3-May-08 23:21 
QuestionDateTime Hour Minute Question Pin
MumbleB3-May-08 22:38
MumbleB3-May-08 22:38 
AnswerRe: DateTime Hour Minute Question Pin
MumbleB3-May-08 22:42
MumbleB3-May-08 22:42 
GeneralRe: DateTime Hour Minute Question Pin
Luc Pattyn3-May-08 23:07
sitebuilderLuc Pattyn3-May-08 23:07 
Hi again,

four remarks this time:

1.
if you were to change the order to "yyyyMMddhhmmss" then the alphabetical order
would be the same as the chronological order, which makes life easier.

2.
you can embed some more characters in the date format string, the ToString() does not
mind about some characters such as an underscore. it just copies them to the output, e.g. I often use "_yyyyMMdd_hhmmss" to get a filename that is more readable.

3.
you don't have to try and do everything in a single line; splitting a statement in two
or three smaller statements yields more readable code, and facilitates debugging, since
now you can set breakpoints on the parts, and watch intermediate results.

4.
if your code is executed repeatedly, you might generate the same filename more than once,
since a modern CPU can do a lot in one second. Even adding milliseconds may be insufficient
since the milliseconds don't get incremented by one, as you might expect; instead they
increase by a larger number but at a lower frequency. For more on this, read my timers
article. A possible remedy is to insert a Thread.Sleep() so the time advances before
you have a chance to generate yet another filename (assuming single-thread use here).

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

I dislike the black-and-white voting system on questions/answers. Dead | X|


GeneralRe: DateTime Hour Minute Question Pin
MumbleB3-May-08 23:45
MumbleB3-May-08 23:45 
GeneralRe: DateTime Hour Minute Question [modified] Pin
#realJSOP4-May-08 3:53
professional#realJSOP4-May-08 3:53 
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 

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.