P.Brian.Mackey
P.Brian.Mackey

Reputation: 44295

What does it mean to have parenthesis when declaring a string variable?

I'm converting VB6 to C#. I have no experience with VB6. What's the difference between:

sWords() As String

and

sWords As String

It's easy to see I can convert the second one to string sWords in C#, but the first I dunno what that means..array?

Upvotes: 3

Views: 465

Answers (2)

dcp
dcp

Reputation: 55467

The first is an array whose bounds are determined at runtime.

So you could do:

Dim arr() As String
arr = Array("love","to","code")

You could also resize the array at runtime:

ReDim arr(1 To 50)

Upvotes: 9

Jon Egerton
Jon Egerton

Reputation: 41579

The first is an array of type String, the second is just a String.

So the equivalents would be

string[] swords

and

string swords

Upvotes: 11

Related Questions