Click here to Skip to main content
15,912,400 members
Home / Discussions / C#
   

C#

 
GeneralDisplaying XML Files in a Data Grid Pin
soloforce12-Aug-03 5:58
soloforce12-Aug-03 5:58 
GeneralRe: Displaying XML Files in a Data Grid Pin
Heath Stewart12-Aug-03 9:00
protectorHeath Stewart12-Aug-03 9:00 
GeneralIntPtr to byte array : Safely Pin
Anonymous12-Aug-03 1:31
Anonymous12-Aug-03 1:31 
GeneralRe: IntPtr to byte array : Safely Pin
Nnamdi Onyeyiri12-Aug-03 3:59
Nnamdi Onyeyiri12-Aug-03 3:59 
GeneralRe: IntPtr to byte array : Safely Pin
James T. Johnson12-Aug-03 5:13
James T. Johnson12-Aug-03 5:13 
GeneralRe: IntPtr to byte array : Safely Pin
Nnamdi Onyeyiri12-Aug-03 5:23
Nnamdi Onyeyiri12-Aug-03 5:23 
GeneralRe: IntPtr to byte array : Safely Pin
Heath Stewart12-Aug-03 9:09
protectorHeath Stewart12-Aug-03 9:09 
Generalsyntax highlighting control... Pin
FreJa11-Aug-03 23:50
FreJa11-Aug-03 23:50 
GeneralRe: syntax highlighting control... Pin
Kannan Kalyanaraman12-Aug-03 0:49
Kannan Kalyanaraman12-Aug-03 0:49 
Generalconstant references to non-constant objects Pin
berndg11-Aug-03 22:33
berndg11-Aug-03 22:33 
GeneralRe: constant references to non-constant objects Pin
James T. Johnson12-Aug-03 1:19
James T. Johnson12-Aug-03 1:19 
GeneralRe: constant references to non-constant objects Pin
berndg12-Aug-03 2:43
berndg12-Aug-03 2:43 
GeneralLinkLabel and Context Menu Pin
..Hubert..11-Aug-03 22:31
..Hubert..11-Aug-03 22:31 
GeneralRe: LinkLabel and Context Menu Pin
James T. Johnson12-Aug-03 1:28
James T. Johnson12-Aug-03 1:28 
GeneralRe: LinkLabel and Context Menu Pin
..Hubert..12-Aug-03 2:19
..Hubert..12-Aug-03 2:19 
QuestionHowto send Text to a Word Doc ? Pin
Anonymous11-Aug-03 21:25
Anonymous11-Aug-03 21:25 
AnswerRe: Howto send Text to a Word Doc ? Pin
MeisterBiber12-Aug-03 1:57
MeisterBiber12-Aug-03 1:57 
GeneralRe: Howto send Text to a Word Doc ? Pin
Anonymous17-Aug-03 20:06
Anonymous17-Aug-03 20:06 
GeneralOperator overloading with strings Pin
hzs11-Aug-03 20:15
hzs11-Aug-03 20:15 
GeneralRe: Operator overloading with strings Pin
J. Dunlap11-Aug-03 21:10
J. Dunlap11-Aug-03 21:10 
GeneralRe: Operator overloading with strings Pin
hzs12-Aug-03 1:39
hzs12-Aug-03 1:39 
GeneralRe: Operator overloading with strings Pin
Ista12-Aug-03 4:16
Ista12-Aug-03 4:16 
GeneralRe: Operator overloading with strings Pin
hzs12-Aug-03 20:09
hzs12-Aug-03 20:09 
GeneralRe: Operator overloading with strings Pin
Ista13-Aug-03 3:39
Ista13-Aug-03 3:39 
GeneralRe: Operator overloading with strings Pin
Julian Bucknall [MSFT]12-Aug-03 6:09
Julian Bucknall [MSFT]12-Aug-03 6:09 
Just want to point something out: Can you imagine the maintainance nightmare that would result from doing what you propose? If you read

string3 = string1 + string2;

in your code 6 or 12 months from now, would you know whether it meant "concatenate" or "treat the strings as numbers and add"? Would your replacement?

What I'm saying is that although the language might allow you to do what you want, do you really want to do it? It's great writing software that's only used once, to prove a point, as it were, but the reality of our game is that we generally have to write code that we'll have to maintain down the road (and if not us, then someone else). In that case, the simpler you express the intent of your program in code, the simpler it is to test and maintain, and the easier it is to go home at 5 o'clock.

My recommendation is to create a small class that encapsulates what you want to do. Override the + operator (and the += operator, and the - operator and the -= operator) to your heart's content at that point. It won't be as confusing as "sometimes in my code the + operator on strings means this, other times it means that".

Cheers, Julian
Program Manager, C#

This posting is provided "AS IS" with no warranties, and confers no rights.

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.