Results 1 to 12 of 12

Thread: "&" in vb.net ..What is the alternative in c#?

  1. #1

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    "&" in vb.net ..What is the alternative in c#?

    We use & in vb.net to join 2 or more strings or Objects...
    What is the alternative for this in c#?
    Thanks
    Godwin

    Help someone else with what someone helped you!

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142

    Re: "&" in vb.net ..What is the alternative in c#?

    +
    eg:
    VB Code:
    1. [COLOR=Blue]string[/COLOR] str = "something " + "something else";
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  3. #3

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: "&" in vb.net ..What is the alternative in c#?

    yes I know the +..This exists in vb.net too,so same thing works here..
    but,what is the substitute for &
    or Maybe there is no substitute available?
    Godwin

    Help someone else with what someone helped you!

  4. #4
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142

    Re: "&" in vb.net ..What is the alternative in c#?

    no, in vb.net you can use + but most of the time it will error, because + means literally that in .NET ( ie: add together a number )

    the C# equivalent of using & is + , & is used in a different manor in C#
    eg:
    VB Code:
    1. if(int someInt = 0 && int SomeotherInt = 1)
    2. {
    3.     // do something;
    4. }
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  5. #5

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: "&" in vb.net ..What is the alternative in c#?

    Ahh
    Roger that...
    Godwin

    Help someone else with what someone helped you!

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: "&" in vb.net ..What is the alternative in c#?

    &var is address of var.
    var1 & var2 is bitwise AND.
    var1 && var2 is logical And.
    The + operator is overriden (or is it overloaded) by the string class to mean concatenate instead of add.

  7. #7

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: "&" in vb.net ..What is the alternative in c#?

    Thanks Penegate
    Godwin

    Help someone else with what someone helped you!

  8. #8
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: "&" in vb.net ..What is the alternative in c#?

    Have a look here for all your C# operator needs

  9. #9

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: "&" in vb.net ..What is the alternative in c#?

    Roger that..
    Looking at it now
    Godwin

    Help someone else with what someone helped you!

  10. #10
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: "&" in vb.net ..What is the alternative in c#?

    Who's this Roger guy you keep going on about?

  11. #11

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: "&" in vb.net ..What is the alternative in c#?

    ummm...
    Affirmitive Wossname
    Godwin

    Help someone else with what someone helped you!

  12. #12

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: "&" in vb.net ..What is the alternative in c#?

    hehehe
    Godwin

    Help someone else with what someone helped you!

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