R How to Continue a Line of Code

How do I continue a line of code on the next line? - For readability

 How do I continue a line of code on the next line? - For readability

Author Message

 How do I continue a line of code on the next line? - For readability

Does C# have anything similar to VB's underscore ( _ )?  So for instance if
I have a really long line of code and rather than scrolling to the right I
would like to continue the same line of code on the following line.

VB example:
==================================
msgbox("This" & _
" is" & _
" a" & _
" test.")

Anything equivalent in C#?

DZ

Tue, 06 Jul 2004 23:51:50 GMT

 How do I continue a line of code on the next line? - For readability

Dave,

Quote:

>Does C# have anything similar to VB's underscore ( _ )?

No, all you have to do is hit Enter. The statement ends at the
semicolon.

MessageBox.Show( "This" +
" is" +
" a" +
" test." );

Mattias

===
Mattias Sj?gren (VB MVP)

http://www.msjogren.net/dotnet/

Wed, 07 Jul 2004 00:08:55 GMT

 How do I continue a line of code on the next line? - For readability

You don't need to do anything special in C# just continue the code on the
next line.

Even this ugly example works:
Label1.

        Text

    = MyString;

Quote:

> Does C# have anything similar to VB's underscore ( _ )?  So for instance
if
> I have a really long line of code and rather than scrolling to the right I
> would like to continue the same line of code on the following line.

> VB example:
> ==================================
> msgbox("This" & _
>     " is" & _
>     " a" & _
>     " test.")

> Anything equivalent in C#?

> DZ

Wed, 07 Jul 2004 00:12:04 GMT

 How do I continue a line of code on the next line? - For readability

Mattias wrote

Quote:

> MessageBox.Show( "This" +
>                  " is" +
>                  " a" +
>                  " test." );

which creates about 7 string objects, correct?

regards
Eugen

Wed, 07 Jul 2004 00:23:17 GMT

 How do I continue a line of code on the next line? - For readability

Wed, 18 Jun 1902 08:00:00 GMT

 How do I continue a line of code on the next line? - For readability

lol, it's that easy?!  i love it, thx alot.

DZ

Quote:

> Dave,

> >Does C# have anything similar to VB's underscore ( _ )?

> No, all you have to do is hit Enter. The statement ends at the
> semicolon.

> MessageBox.Show( "This" +
>                  " is" +
>                  " a" +
>                  " test." );

> Mattias

> ===
> Mattias Sj?gren (VB MVP)

> http://www.msjogren.net/dotnet/

Wed, 07 Jul 2004 00:23:58 GMT

 How do I continue a line of code on the next line? - For readability

Wed, 18 Jun 1902 08:00:00 GMT

 How do I continue a line of code on the next line? - For readability

yes, so actually, this is how I use it:
// TODO: before release:  remove string concanation.
MessageBox.Show( "This" +
" is" +
" a" +
" test." );

Tue, 06 Jul 2004 12:34:53 GMT

 How do I continue a line of code on the next line? - For readability

Eugen,

    Actually, no, it doesn't.  The reason is that the C# compiler is smart
enough to know that they are constants, and will actually save the string in
the executable as:

"This is a test."

    This is great, in my opinion.  I hated the fact that VB used to do this.

--
- Nicholas Paldino [.NET MVP]

Quote:

> Mattias wrote

> > MessageBox.Show( "This" +
> >                  " is" +
> >                  " a" +
> >                  " test." );

> which creates about 7 string objects, correct?

> regards
> Eugen

Wed, 07 Jul 2004 00:47:50 GMT

 How do I continue a line of code on the next line? - For readability

Quote:

> Mattias wrote

> > MessageBox.Show( "This" +
> >                  " is" +
> >                  " a" +
> >                  " test." );

> which creates about 7 string objects, correct?

Syntactically there are four, but the compiler creates only one.

--
For mail, please use my surname where indicated:

Wed, 07 Jul 2004 00:48:51 GMT

 How do I continue a line of code on the next line? - For readability

On Fri, 18 Jan 2002 17:23:17 +0100, in

Quote:

>Mattias wrote

>> MessageBox.Show( "This" +
>>                  " is" +
>>                  " a" +
>>                  " test." );

>which creates about 7 string objects, correct?

>regards
>Eugen

Nope. The compiler is clever enough to intern just one in this case.

For something like

"sdjhgf" + "kghjg" + obj.ToString() + "hjg" + "jhgf"

I think  - not sure - that 2 strings will be stored.

--
Simon
www.quintuslink.com

Wed, 07 Jul 2004 01:41:13 GMT

morrisguideare.blogspot.com

Source: http://computer-programming-forum.com/4-csharp/220c6047f12a266f.htm

0 Response to "R How to Continue a Line of Code"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel