Re: String() declaration?



Hello Cor,

With VB 2008 it is in my idea more and more

Dim temp() ={"hello","world"}

Well i guess that the infer options are not yet so wide spread at the common
programmers , i hear a lot of huhs ? when one of my peers opens one of my
new created projects and encounters code where i skipped the type
declaration and used inference to do this for me .

And it becomes a Complete party of HUHS ?? !!! when they open my projects
where i use LINQ to XML and see that i do in a few lines of code where they
coded multiple complete methods for to do the same .

But it just might be the future standard if the common coder wakes up and
sees there is a new kid to play with in town , Currently however you see
the most the classic syntax followed by the "New" C style syntax probably
just because it is more known .

Wich gives me the second thought ,,, is the new C style syntax beeing
addopted by the VB comunity because more and more VB coders also code C# or
is the new syntax the new standard in teaching books / courses , or is it so
that more and more C style proggers use VB .

regards

Michel



"Cor Ligthert[MVP]" <Notmyfirstname@xxxxxxxxx> schreef in bericht
news:efGM1wrOJHA.4700@xxxxxxxxxxxxxxxxxxxxxxx
Michel,

With VB 2008 it is in my idea more and more

Dim temp() ={"hello","world"}

You probably don't agree this with me, but I have the meaning that as less
you have to write and let done by the computer the better.

The effect is the same. It is a complete early binded array of strings.

Cor

"Michel Posseth" <msdn@xxxxxxxxxxx> wrote in message
news:eVu$I1nOJHA.3748@xxxxxxxxxxxxxxxxxxxxxxx
Hello Anil ,

Dim temp() as String

is the classic VB syntax to declare an array

VB also supports

Dim temp as String()


This method is more intuitiv to programmers with a C background , this is
also a big advantage for coders who both use C# and VB
in early versions of VB.Net ( 2002 and i guess 2003 i believe , but i am
not sure ) there was a difference

Between the two the new method could not be used to declare and
instantiate the array in one line

Dim temp() as String ={"hello","world"} worked but Dim temp as
String()={"hello","world"} did not work in early versions

Nowadays in VB.Net 2005 and 2008 both work the same so it becomes a
mather of taste wich one of the 2 you use
as you see the VB language also evolves in a forward kind of way :-)

I concur with Onur regarding his remark that you see more and more "Dim
temp as String()"in code examples on the net


HTH

Michel Posseth [MCP]
http://www.vbdotnetcoder.com




"Anil Gupte/iCinema.com" <anil-list@xxxxxxxxxxx> schreef in bericht
news:uAROveZOJHA.2100@xxxxxxxxxxxxxxxxxxxxxxx
Can someone please explan the difference between

Dim temp as String()

and

Dim temp() as String

in terms of syntax and practical usage? I thought I knew, but of late
have become confused due to reasons too complicated to go in here.

Will appreciate your inputs.
--
Anil Gupte
www.keeninc.net
www.icinema.com
www.wizo.tv




.



Relevant Pages

  • Re: String() declaration?
    ... and common syntax acrooss languages. ... Dim temp() as String ...
    (microsoft.public.dotnet.languages.vb)
  • Re: String() declaration?
    ... programmers, the reason is of course obvious, how do you get the Java ... the most the classic syntax followed by the "New" C style syntax probably ... Dim temp() as String ...
    (microsoft.public.dotnet.languages.vb)
  • Re: String() declaration?
    ... Dim temp as String() ... in terms of syntax and practical usage? ...
    (microsoft.public.dotnet.languages.vb)
  • String() declaration?
    ... Dim temp as String() ... in terms of syntax and practical usage? ...
    (microsoft.public.dotnet.languages.vb)
  • Re: inconsistent behavior of >FLOAT
    ... If the string represents a valid floating-point number in the syntax ... if the string does not match the syntax given then false ... ">FLOAT enables programs to read floating-point data in legible ASCII format. ...
    (comp.lang.forth)