Click here to Skip to main content
15,887,477 members
Home / Discussions / C#
   

C#

 
GeneralRe: The SetAttribute does not set attribute Pin
Meysam Toluie17-Apr-13 19:35
Meysam Toluie17-Apr-13 19:35 
GeneralRe: The SetAttribute does not set attribute Pin
dusty_dex17-Apr-13 23:46
dusty_dex17-Apr-13 23:46 
QuestionWhich Constructor is Better? Pin
Jasmine250116-Apr-13 12:15
Jasmine250116-Apr-13 12:15 
AnswerRe: Which Constructor is Better? Pin
Matt T Heffron16-Apr-13 12:47
professionalMatt T Heffron16-Apr-13 12:47 
GeneralRe: Which Constructor is Better? Pin
Jasmine250116-Apr-13 14:34
Jasmine250116-Apr-13 14:34 
GeneralRe: Which Constructor is Better? Pin
PIEBALDconsult16-Apr-13 15:01
mvePIEBALDconsult16-Apr-13 15:01 
GeneralRe: Which Constructor is Better? Pin
Jasmine250117-Apr-13 5:36
Jasmine250117-Apr-13 5:36 
GeneralRe: Which Constructor is Better? Pin
Matt T Heffron17-Apr-13 9:53
professionalMatt T Heffron17-Apr-13 9:53 
The const for the string is really the better way.
Remember that in c#, strings are invariant. So the compiler can and will automatically use the same actual string no matter how often it is referenced. Referencing a string const multiple times, or using the identical string literal multiple times is the same. Only one string will be stored in the program and all of the references to it will be to the exact same object.

So why did I say the const for string is better?
For maintainability. The name of the const can (should) be based on the functional use of the value, and can be updated in a single location, guaranteed to affect all uses. With string literals it is easy to miss one Smile | :)
GeneralRe: Which Constructor is Better? Pin
Jasmine250117-Apr-13 9:57
Jasmine250117-Apr-13 9:57 
GeneralRe: Which Constructor is Better? Pin
Matt T Heffron17-Apr-13 10:02
professionalMatt T Heffron17-Apr-13 10:02 
GeneralRe: Which Constructor is Better? Pin
Jasmine250117-Apr-13 10:04
Jasmine250117-Apr-13 10:04 
AnswerRe: Which Constructor is Better? Pin
Matt T Heffron17-Apr-13 10:07
professionalMatt T Heffron17-Apr-13 10:07 
GeneralRe: Which Constructor is Better? Pin
Matt T Heffron17-Apr-13 13:35
professionalMatt T Heffron17-Apr-13 13:35 
AnswerRe: Which Constructor is Better? Pin
V.16-Apr-13 20:23
professionalV.16-Apr-13 20:23 
AnswerRe: Which Constructor is Better? Pin
Orjan Westin16-Apr-13 22:45
professionalOrjan Westin16-Apr-13 22:45 
GeneralRe: Which Constructor is Better? Pin
Richard Deeming17-Apr-13 0:39
mveRichard Deeming17-Apr-13 0:39 
GeneralRe: Which Constructor is Better? Pin
Orjan Westin17-Apr-13 1:58
professionalOrjan Westin17-Apr-13 1:58 
GeneralRe: Which Constructor is Better? Pin
Jasmine250117-Apr-13 5:39
Jasmine250117-Apr-13 5:39 
AnswerRe: Which Constructor is Better? Pin
jschell17-Apr-13 9:18
jschell17-Apr-13 9:18 
GeneralRe: Which Constructor is Better? Pin
Jasmine250117-Apr-13 9:28
Jasmine250117-Apr-13 9:28 
QuestionLoading Very Large DataSet Without losing any information Pin
losan16-Apr-13 7:23
losan16-Apr-13 7:23 
AnswerRe: Loading Very Large DataSet Without losing any information Pin
Dave Kreskowiak16-Apr-13 7:58
mveDave Kreskowiak16-Apr-13 7:58 
AnswerRe: Loading Very Large DataSet Without losing any information Pin
SledgeHammer0116-Apr-13 8:05
SledgeHammer0116-Apr-13 8:05 
AnswerRe: Loading Very Large DataSet Without losing any information Pin
Pete O'Hanlon16-Apr-13 9:33
mvePete O'Hanlon16-Apr-13 9:33 
GeneralRe: Loading Very Large DataSet Without losing any information Pin
Rockstar_16-Apr-13 18:24
professionalRockstar_16-Apr-13 18:24 

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.