Re: Console.WriteLine(s) Is Missing Line Terminator?



Let me step in and support Mattias here.

According to Francesco Balena: "The + operator is supported
as a string concatenation operator only for historical
reasons. Using the & operator to concatenate strings
instead of the + operator makes your code more readable
and less ambiguous."

I completely agree. When I see this:

myData = firstData + secondData

If I don't know if those are strings or numerics,
I won't know if it's concatenating or adding.

And when Microsoft says something is included "for historical
reasons", to me it's like saying "Say Hasta La Vista to
this feature in the next version, baby."

Robin S.
-------------------------------------

"Gadget" <gadget@xxxxxxxxxx> wrote in message
news:4ebi6gkpz0ah$.kvwwrhdycu4t$.dlg@xxxxxxxxxxxxx
On Sat, 18 Nov 2006 00:07:40 +0100, Mattias Sjögren wrote:

Also as a rule of thumb, avoid using '&' to concatenate strings, as it
has
a tendency to hide casting errors.

Huh? Can you give an example of that? And what do you suggest we use
instead? Hopefully not the + operator.


It's only in there for VB6 style compatibility,

No it certainly isn't.


Mattias

I'm still fascinated to hear your reasoning, Mattias. Don't let this
thread
die... :)

Cheers,
Gadget


.



Relevant Pages

  • Re: string concatenation optimizations [from python-dev Summary]
    ... Essentially what I have in mind is a type that's a list of byte ... The value is defined as the concatenation of these arrays. ... > way to concatenate a bunch of strings. ...
    (comp.lang.python)
  • Re: why use the data command parameter collection
    ... cumbersome than using an iterative object oriented approach. ... quote characters or other such input by concatenating strings. ... Parameters Collection. ... Also the approach string concatenation leaves a lot to be desired (see ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: concat vs variable in string
    ... Or does it still do a concatenation behind the scenes? ... If you use single quotes instead of double, ... massive strings or a long loop. ... to be wrapped in double quoted strings, ...
    (comp.lang.php)
  • Re: From D
    ... string concatenation and allow numeric literals to implicitly concatenate? ... Did you miss the bit where Python ALREADY does this for strings? ... because two int tokens can be "concatenated" to make a single int token, ...
    (comp.lang.python)
  • Re: deepening into fortran 90,95, 2003
    ... I've been bitten many times by the slowness of concatenation of strings. ... Support the Original G95 Project: http://www.g95.org ... Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html ...
    (comp.lang.fortran)