Jaiesh_bhai
Jaiesh_bhai

Reputation: 1814

Converting vb.net to c# with Object

I have the following vb.net line:

Dim applesAs Object() = New Object([end] - startIndex - 1) {}

and Developer Fusion's Converter converts it to this c# line:

object[] apples= new object[end - startIndex - 1];

The c# code seems to create an array of objects called apples, however I cannot find what the constructor for Object in vb is doing. Is it also creating an array? Am I wrong about what the c# line seems to be doing?

Upvotes: 0

Views: 523

Answers (2)

skyfoot
skyfoot

Reputation: 20769

Both the vb.net and c# code are creating an object array called apples.

  • c# uses [] to indicate an array
  • vb.net uses () to indicate an array

The parameters set the size of the array

new Object(5) 'vb.net
new object[6] //c#

Upvotes: 3

Habib
Habib

Reputation: 223187

however I cannot find what the constructor for Object in vb is doing.

Its not a constructor call,() are used in VB.Net for array indexing.

Also there is no constructor accepting a parameter with Object

Upvotes: 7

Related Questions