-
C# operator...
Code:
private void Form1_MouseClick(object sender, MouseEventArgs e)
{
label1.Text = "x:" && MousePosition.X.ToString();
}
i get an error saying that Error, Operator '&&' cannot be applied to operands of type 'string' and 'string'
I know that in VB.net i can just type "string" & something.text & "string"
what am i doing wrong in C# ?
how can i get the "x:" and the mouseposition to stand on one line ? :S
-
Re: C# operator...
Use the "+" operator to concatenate strings. "&&" is the logical "and" operator.
-
Re: C# operator...
In VB.NET the '&' is the string concatenation operator. In C# the '&' and '&&' are boolean and bitwise operators, like 'And' and 'AndAlso' in VB.NET. The string concatenation operator in C# is '+'. Note that '+' will also concatenate two strings in VB.NET.