I can do this in one line in VB.NET , How (if possible) to do this in C# (one line also) ?
VB Code:
Dim a As String Dim b As String : a = 20
I want to do multiple things in one line :D
Printable View
I can do this in one line in VB.NET , How (if possible) to do this in C# (one line also) ?
VB Code:
Dim a As String Dim b As String : a = 20
I want to do multiple things in one line :D
I guess I don't have to use special symbols . Cool .:D
try:
Is that what you were looking for?Code:string a = 20;
heh , I know that . that's just an example . I was asking about how to do multiple code lines in one . ;)Quote:
Originally posted by toto
try:
Is that what you were looking for?Code:string a = 20;
Well as long as you put the semicolon, you can do it.
Exactly , but I thought that like in VB.NET which needs to add " : " after every line of code .Quote:
Originally posted by DevGrp
Well as long as you put the semicolon, you can do it.
you can put multiple statements in a line like the other guy said (too lazy to look at the nick :| ) because c# compiler only looks for it and not for paragrphs like vb one does..also if you want you can do
string lol = "hi";;;;;;;;;;;;;;;;;;;;
this wont raise any error thu it has no particular meaning!
for the interested ones thu it has nothing to do try putting double opening braces in the IDE and see what happens!
This is new . :DQuote:
because c# compiler only looks for it and not for paragrphs like vb one does..also if you want you can do
I don't get it !Quote:
for the interested ones thu it has nothing to do try putting double opening braces in the IDE and see what happens!
hehe :DQuote:
(too lazy to look at the nick :| )
have u ever put a function in a MFC like notation(i think is how they call it) something like this...
put this code into the IDE
and put this:Code:public void myFunction(
int a,
int b,
int c,
int d) { {
}
}
then put some code inside both of them and format it deleting the closing brace of each one so the IDE formats them...you'll notice as the 1st one is a lot easier to readCode:public void myFunction(
int a,
int b,
int c,
int d) {
}
Hmm , I think I'm doing it the wrong way ..lol . What do you mean by "and format it deleting ". What does it look like when I'm done ? :D