views:

165

answers:

2

for this line:

Private _allowedLocations As Point() = New () {New Point(50, 50), New Point(500, 500), New Point(700, 100)

i am getting the error "type expected for 'new ()'

whats wrong with the syntax?

+3  A: 

You need to repeat the type name before the (). You can rewrite the code as follows

Private _allowedLocations As Point() = New Point() {New Point(50, 50), New Point(500, 500), New Point(700, 100) }
JaredPar
+3  A: 

I thought the whole New-expression was unnecessary:

Private _allowedLocations As Point() = {New Point(50, 50), New Point(500, 500), New Point(700, 100) }
Kim Gräsman
Yes it is. It was actually me providing the offending code to start with; auto-converted from C# but still. I am ashamed...
Fredrik Mörk
it was not offensive at all, i want to thank you again for helping me
I__
When VB10 arrives with implicitly typed arrays, you could leave off the "As Point" too.
MarkJ
Fredrik -- good to see you. Well, you gave me an opportunity to flash my wicked VB.NET skills :)
Kim Gräsman