Cole Tobin
Cole Tobin

Reputation: 9429

What is the & Symbol in VB?

I have this VB code that I am converting for someone, but he didn't comment it, so what does it mean

Dim Arguments As String = path & "\" & fs & ".freeze" & " ls"

Upvotes: 3

Views: 342

Answers (3)

Kishore Kumar
Kishore Kumar

Reputation: 12864

private string _arguments = Path.Combine(path, fs + ".freeze") + " ls";

This should work.

Upvotes: 1

David Heffernan
David Heffernan

Reputation: 612794

The & operator in Visual Basic is used to concatenate strings. In C# the concatenation operator is + and so the direct translation is

string Arguments = path + @"\" + fs + ".freeze" + " ls";

Better in my view would be to use Path.Combine:

string Arguments = Path.Combine(path, fs + ".freeze") + " ls";

Upvotes: 9

Jon Skeet
Jon Skeet

Reputation: 1499790

That's just string concatenation:

string arguments = path + @"\" + fs + ".freeze" + " ls";

Upvotes: 3

Related Questions