L
Lecture Snoddddgrass
Back in the old Visual C++ days, it was always important to define constant
strings only once so that they wouldn't be stored over and over again in
memory. Has .NET resolved this issue? Consider these two code snippets:
Example A
========
const String hey="hey";
MessageBox.Show(hey);
MessageBox.Show(hey);
MessageBox.Show(hey);
Example B
========
MessageBox.Show("hey");
MessageBox.Show("hey");
MessageBox.Show("hey");
Does Example A make more efficient use of memory since "hey" is only stored
once in memory?... or is Example B just as efficient because the compiler is
smart enough to realize that "hey" is the *same* constant literal string
that is referenced three times in a row?
Sincerely,
Michael Jackson's Nose
strings only once so that they wouldn't be stored over and over again in
memory. Has .NET resolved this issue? Consider these two code snippets:
Example A
========
const String hey="hey";
MessageBox.Show(hey);
MessageBox.Show(hey);
MessageBox.Show(hey);
Example B
========
MessageBox.Show("hey");
MessageBox.Show("hey");
MessageBox.Show("hey");
Does Example A make more efficient use of memory since "hey" is only stored
once in memory?... or is Example B just as efficient because the compiler is
smart enough to realize that "hey" is the *same* constant literal string
that is referenced three times in a row?
Sincerely,
Michael Jackson's Nose