We use & in vb.net to join 2 or more strings or Objects...
What is the alternative for this in c#?
Thanks :)
Printable View
We use & in vb.net to join 2 or more strings or Objects...
What is the alternative for this in c#?
Thanks :)
+
eg:
VB Code:
[COLOR=Blue]string[/COLOR] str = "something " + "something else";
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?
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:
if(int someInt = 0 && int SomeotherInt = 1) { // do something; }
Ahh
Roger that...
&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.
Thanks Penegate :)
Have a look here for all your C# operator needs :)
Roger that..
Looking at it now
Who's this Roger guy you keep going on about?
ummm...
Affirmitive Wossname
hehehe