Re: string concatenation
From: Jay B. Harlow [MVP - Outlook] (Jay_Harlow_MVP_at_msn.com)
Date: 10/05/04
- Next message: Jay B. Harlow [MVP - Outlook]: "Re: TEST2"
- Previous message: John: "DrawLine(Pens.Green, 0, 0, 30, 30) does not draw this time?"
- In reply to: Bonj: "Re: string concatenation"
- Next in thread: Herfried K. Wagner [MVP]: "Re: string concatenation"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 5 Oct 2004 12:00:49 -0500
Bonj,
>> + is also used to concatenate strings in VB6!
>
> I know, but only in BAD VB6.
IMHO Then there's your answer...
> Coming from C# I was unaware whether & might be used for binary bitmask
> and,
> but it seems the word "And" is what's used?
& : string concatenation
And : bitwise and
AndAlso : logical short circuit and
Or : bitwise or
OrElse : logical short circuit or
FWIW: Paul Vick's "The Visual Basic .NET Programming Language" from Addison
Wesley
is a good (right size, right content) desk reference to the VB.NET language
itself. Paul's book covers just the language, not the framework.
Hope this helps
Jay
"Bonj" <Bonj@discussions.microsoft.com> wrote in message
news:23706DBB-98C1-4D67-B8C5-96B5080F05A7@microsoft.com...
>> Bonj,
>> + is also used to concatenate strings in VB6!
>
> I know, but only in BAD VB6.
>
>
>> I use & as it is the concatenation operator, while + is the addition
>> operator.
>
> Coming from C# I was unaware whether & might be used for binary bitmask
> and,
> but it seems the word "And" is what's used?
> (If you ask why I go from C# to VB.NET, it's because the amount of times
> I've typed "using SYstem ..." and done a load of backspaces and retyped
> it
> with "using System... " I must be able to write one more complete project
> per
> year.)
>
>>
>> If you have Option Strict Off, the + may convert its arguments to or from
>> String first before performing the Addition.
>
> I always have option strict on.
>
>>
>> StringBuilder has its place as does + and &. If I have a loop I will use
>> a
>> StringBuilder, where as if I have a single line I will probably use &.
>>
>> Of course if profiling proved that one was performing badly in a specific
>> routine, I would try the other to see if that improved performance.
>>
>> I would not combine StringBuilder and & in a single line, such as
>> concatenating two strings to pass to StringBuilder.Append, as that is
>> rarely
>> correct...
>>
>> Hope this helps
>
> Yes, thanks very much
>
>
- Next message: Jay B. Harlow [MVP - Outlook]: "Re: TEST2"
- Previous message: John: "DrawLine(Pens.Green, 0, 0, 30, 30) does not draw this time?"
- In reply to: Bonj: "Re: string concatenation"
- Next in thread: Herfried K. Wagner [MVP]: "Re: string concatenation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|