Results 1 to 10 of 10

Thread: All in one line ??[Resolved]

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Talking All in one line ??[Resolved]

    I can do this in one line in VB.NET , How (if possible) to do this in C# (one line also) ?

    VB Code:
    1. Dim a As String
    2. Dim b As String : a = 20

    I want to do multiple things in one line

  2. #2

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: All in one line ??

    I guess I don't have to use special symbols . Cool .

  3. #3
    Lively Member
    Join Date
    Sep 2002
    Posts
    100
    try:

    Code:
    string a = 20;
    Is that what you were looking for?

  4. #4

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by toto
    try:
    Code:
    string a = 20;
    Is that what you were looking for?
    heh , I know that . that's just an example . I was asking about how to do multiple code lines in one .

  5. #5
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Well as long as you put the semicolon, you can do it.

  6. #6

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by DevGrp
    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 .

  7. #7
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    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!
    \m/\m/

  8. #8

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    because c# compiler only looks for it and not for paragrphs like vb one does..also if you want you can do
    This is new .

    for the interested ones thu it has nothing to do try putting double opening braces in the IDE and see what happens!
    I don't get it !

    (too lazy to look at the nick :| )
    hehe

  9. #9
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    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
    Code:
    		public void myFunction(
    			int a,
    			int b,
    			int c,
    			int d) { {
    					 }
    		}
    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 read
    \m/\m/

  10. #10

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    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 ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width