Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's different between Dim files() As String and Dim files As String()?

Tags:

arrays

vb.net

In this code:

Dim files() As String = Directory.GetFiles("C:/")

Dim files As String() = Directory.GetFiles("C:/")

is there a difference between the statements?

like image 764
Cheung Avatar asked Feb 11 '10 03:02

Cheung


2 Answers

The two are identical. If you use Reflector, you can see that they are compiled to the same IL:

.field private string[] files
like image 110
Mark Byers Avatar answered Oct 16 '22 06:10

Mark Byers


They produce exactly the same thing - just two alternative forms of declaration.

like image 22
Bill Avatar answered Oct 16 '22 06:10

Bill