How to shorthand array declaration in a method call?

Posted by Paul Sasik on Stack Overflow See other posts from Stack Overflow or by Paul Sasik
Published on 2010-03-25T22:03:46Z Indexed on 2010/03/25 22:33 UTC
Read the original article Hit count: 364

Filed under:
|
|
|

Hi all,

This is hopefully a softball syntax question: I need to call a method with an empty Object array for evaluation and set initial state. In C# I would just do this:

func(new Object[]{});

In VB.NET I am forced to do this:

Dim ctrls() As Control = {}
func(ctrls)

Is there a way to shorthand the call in VB.NET and have everything happen in one line of code?

P.S. VB-bashing will earn bonus points. ;-)

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about c#