String() declaration?

  • Thread starter Thread starter Anil Gupte/iCinema.com
  • Start date Start date
A

Anil Gupte/iCinema.com

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.
 
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.

Fairly same. However you can get used to one of them depending on your
taste. Putting parantheses just after variable to declare array seems
more than the other decleration option on the net.

Thanks,

Onur G.
 
Onur,
Fairly same.

Fairly? In my idea simple like Andrew wrote None
However you can get used to one of them depending on your
taste. Putting parantheses just after variable to declare array seems
more than the other decleration option on the net.

What do you want to tell with the last sentence?
Beside that it is not true, this behaviour is a language feature not a Net
feature.

Because that a lot of Islamitic countries use the Arabic language, does not
mean that every Islamatic country should do that.

The later sentence jmo.

Cor
 
Onur,


Fairly? In my idea simple like Andrew wrote None

I meant they are same, just location of parantheses are different,
that's all.
What do you want to tell with the last sentence?
Beside that it is not true, this behaviour is a language feature not a Net
feature.

I meant, you can use both and it depends on your taste, plus i did NOT
claim that is a .net feature, it's obvious that VB language allows 2
types of array declaration of strings.. And also i found more samples
that uses parantheses just after variable when declaring string
arrays.
Because that a lot of Islamitic countries use the Arabic language, does not
mean that every Islamatic country should do that.

Couldn't set up any relation between the topic and with that sentence
and i beleive it's not needed to extend issue with off-topic
statements.
The later sentence jmo.

Cor

Onur G.
 
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
 
Onur,

Couldn't set up any relation between the topic and with that sentence
and i beleive it's not needed to extend issue with off-topic
statements.

This of topic sentence is completely yours.

However, I don't agree that it is off topic to use examples related to
natural languages, you know this is a language newsgroup.

Cor
 
Onur,

Couldn't set up any relation between the topic and with that sentence
and i beleive it's not needed to extend issue with off-topic
statements.

This of topic sentence is completely yours.

However, I don't agree that it is off topic to use examples related to
natural languages, you know this is a language newsgroup.

Cor

I meant that off-topic statement which you posted:
"Because that a lot of Islamitic countries use the Arabic language,
does not
mean that every Islamatic country should do that. "

Seems you like making that kind of statements frequently as i came
across on that newsgroup, however it is not important, the thing which
i focused was the topic.(string arrays).

However thanks Michel for focusing on topic and explaining better what
i meant.

Onur G.
 
Cor Ligthert wrote:
What do you want to tell with the last sentence?
Beside that it is not true, this behaviour is a language feature not a Net
feature.
<snip>

Maybe my english is too crippled (I'm Brazilian) but it seemed clear
in the original sentence that "net" in the phrase meant *the
Internet*, not Microsoft's .Net, in the sense that the poster sees *in
the Internet* more people using parenthesis in the variable name than
in the type name.

Regards,

Branco.
 
Cor Ligthert wrote:




<snip>

Maybe my english is too crippled (I'm Brazilian) but it seemed clear
in the original sentence that "net" in the phrase meant *the
Internet*, not Microsoft's .Net, in the sense that the poster sees *in
the Internet* more people using parenthesis in the variable name than
in the type name.

Regards,

Branco.

Hi Branco,
Your English is good enough to make out what i wrote was all about,
you're absolutely accurate. However i didn't want to point again and
again that i meant "the internet" rathar than ".net framework" by
writing "on the net".

And yes, most of samples that i found on the "internet" use variables
followed by parantheses to declare string arrays.
( Dim temp() As String )

Thanks for your input,

Onur Güzel
 
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 said:
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 said:
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
 
Onur,

Not at all, I like your contributions very much, but don't fear that I try
to help you as well as I like it as you correct me as I write somthing which
is wrong.
That is why information that comes from a newsgroup in my idea so good.

I am not in competition here.

However, I like what Mustafa Kemal Atatürk did very much, and what I wrote
came in my mind thinking about him, where I thought that you saw direct with
this what I was meaning.

:-)

Cor

Onur,

Couldn't set up any relation between the topic and with that sentence
and i beleive it's not needed to extend issue with off-topic
statements.

This of topic sentence is completely yours.

However, I don't agree that it is off topic to use examples related to
natural languages, you know this is a language newsgroup.

Cor

I meant that off-topic statement which you posted:
"Because that a lot of Islamitic countries use the Arabic language,
does not
mean that every Islamatic country should do that. "

Seems you like making that kind of statements frequently as i came
across on that newsgroup, however it is not important, the thing which
i focused was the topic.(string arrays).

However thanks Michel for focusing on topic and explaining better what
i meant.

Onur G.
 
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 said:
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 said:
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 said:
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
 
Thanx for the excellent explanation. In fact after reading a few messages
that said it did not matter, my next question was going to be "How would it
be done in C++ and other more mature languages?" This way I can use better
and common syntax acrooss languages.

Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com
www.wizo.tv
Michel Posseth said:
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 said:
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
 
Michel,

There is in my idea more in C# from VB then is told to the C type
programmers, the reason is of course obvious, how do you get the Java
programmer over the border.

Don't forget that C# is the number 3 language for Microsoft.

I use both languages, but prefer VB because it is a living language while C#
has for me more the effects from Latin.

But it is true, C# is simpler and as I wrote above more static in is
progress and therefore easier to use in books or to learn programming.

jmo

Cor

Michel Posseth said:
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 said:
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 said:
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" <[email protected]> schreef in bericht
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
 
----- Original Message -----
From: "Anil Gupte/iCinema.com said:
Dim temp as String()

and

Dim temp() as String

To eliminate confusion I strongly suggest sticking with the latter. Why? If
you want to initialize your arrary boundaries, this is valid:

Dim temp(6) as String

.....while this is not:

Dim temp as String(6)


Regards,

-M
 
Back
Top