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
Your looking to put each if statement on a diffrent line? Nothing special is needed.
if( i == 1 ||
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");
}
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!
Ok, too easy. Maybe I was thinking of strings when I was trying to remember the syntax.
Thanks!
Zath
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