C# if || and new line

I have done this many times in VB and once in C# and can't find where I did it in C#, so, here it is.

In VB, an if statement may get long, well, off your viewing page because the strings are long, so, it is broken down into a new line.

For instance in VB....

If i = 1 _

Or i = 2 _

Or i = 3 Then

'do something

End If

I have found the need for this in C# and just can't remember the syntax for it and can't find where I did it before.

if(i == 1 || i == 2 ||  i == 3)

But placing each new or on a new line.
Tried the conversion sites with no luck.

Suggestions?

Thanks all,

Zath

0 Zath 7/14/2005 6:22:33 PM

Your looking to put each if statement on a diffrent line? Nothing special is needed.

if( i == 1 ||

 

0 Justise 7/14/2005 6:40:03 PM

Your looking to put each if statement on a diffrent line? Nothing special is needed.

if( i == 1 ||
    i == 2 ||
    i == 3 )
{
   Console.WriteLine("i is a simple number");
}

0 Justise 7/14/2005 6:40:47 PM
if ( i == 1 
     || i == 2
     || i == 3 )
{
// do something
}


Darrell Norton, MVP
Darrell Norton's Blog


Please mark this post as answered if it helped you!
0 DarrellNorton 7/14/2005 6:53:30 PM
Ok, too easy.  Maybe I was thinking of strings when I was trying to remember the syntax.

Thanks!

Zath
0 Zath 7/14/2005 7:13:40 PM
this is the language syntax differences where in VB it reads lines and C#, Java or C++ does not
Fadil Alnassar
www.fadilalnassar.com | FREE Nodil Tab Control
http://www.mefranchising.com
0 fadil1977 7/14/2005 10:14:07 PM
Reply:

(Thread closed)