Syntax 
Author Message
 Syntax

Hi,

Are these two stmts equivalent?

Dim s() as string
Dim s as string()

If not, why?

Thank you.

Chris



Sat, 05 Nov 2005 00:07:52 GMT  
 Syntax
The former allocates space for a string array the latter which I believe
should be Dim s as String = New String() initializes a new string variable
and calls the string contstructor with an empty value.


Quote:
> Hi,

> Are these two stmts equivalent?

> Dim s() as string
> Dim s as string()

> If not, why?

> Thank you.

> Chris



Sat, 05 Nov 2005 01:26:21 GMT  
 Syntax
Hello,


Quote:
> The former allocates space for a string array the latter
> which I believe should be Dim s as String = New
> String() initializes a new string variable and calls the
> string contstructor with an empty value.

No, both statements declare an "empty" string array.

Regards,
Herfried K. Wagner
--
http://www.mvps.org/dotnet



Sat, 05 Nov 2005 01:37:26 GMT  
 Syntax
Thank you Herfried for setting me straight.

Dim s() as string
Dim s as string() ' This syntax is strange

Dan



Quote:
> Hello,


> > The former allocates space for a string array the latter
> > which I believe should be Dim s as String = New
> > String() initializes a new string variable and calls the
> > string contstructor with an empty value.

> No, both statements declare an "empty" string array.

> Regards,
> Herfried K. Wagner
> --
> http://www.mvps.org/dotnet



Sat, 05 Nov 2005 02:12:10 GMT  
 Syntax

Quote:
> Are these two stmts equivalent?

Yes.

Quote:
> Dim s() as string
> Dim s as string()

> If not, why?

--
Armin


Sat, 05 Nov 2005 02:03:26 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. VB 6 Syntax vx VB .NET Syntax

2. Syntax error w/ no error in syntax.

3. basic syntax vs crystal syntax

4. diffrence between "crystal syntax" and "basic syntax"**

5. syntax to reference to subform in vba code????

6. refernce subform syntax in VBA

7. SQL syntax error - HELP BEFORE I JUMP!

8. Simple Object Browser Syntax Problem

9. syntax of SQL statement needs help

10. Reading syntax of an Oracle View

11. Syntax on INSERT INTO ?

12. Syntax Error in SQL statement

 

 
Powered by phpBB® Forum Software