is this ok with arrays | | |
hey all,
i have the following dim statement:
Dim myArray() As Boolean = {enum.value1 = True, enum.value2 = True,
enum.value3 = True, enum.value4 = True, enum.value5 = True}
instead of
dim myArray() as boolean={true,true,true,true,true}
or is there a better way for readability?
thanks,
rodchar | | | | re: is this ok with arrays
Rodchanr,
[color=blue]
>
> Dim myArray() As Boolean = {enum.value1 = True, enum.value2 = True,
> enum.value3 = True, enum.value4 = True, enum.value5 = True}
>
> instead of
>
> dim myArray() as boolean={true,true,true,true,true}
>[/color]
Did you use Option Strict On.
In my idea are the however not the same and gives the above
false,false,false,false,false.
Therefore what do you want to do and what do you want to express for
readability?
Cor | | | | re: is this ok with arrays
"rodchar" <rodchar@discussions.microsoft.com> schrieb:[color=blue]
> Dim myArray() As Boolean = {enum.value1 = True, enum.value2 = True,
> enum.value3 = True, enum.value4 = True, enum.value5 = True}
>
> instead of
>
> dim myArray() as boolean={true,true,true,true,true}
>
> or is there a better way for readability?[/color]
Both samples are not semantically equivalent. The first line will compare
enumeration values with 'True', which doesn't necessarily lead to the value
'True' written to the array.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/> | | | | re: is this ok with arrays
sorry bout that, I wasn't thinking.
"Cor Ligthert" wrote:
[color=blue]
> Rodchanr,
>[color=green]
> >
> > Dim myArray() As Boolean = {enum.value1 = True, enum.value2 = True,
> > enum.value3 = True, enum.value4 = True, enum.value5 = True}
> >
> > instead of
> >
> > dim myArray() as boolean={true,true,true,true,true}
> >[/color]
> Did you use Option Strict On.
>
> In my idea are the however not the same and gives the above
>
> false,false,false,false,false.
>
> Therefore what do you want to do and what do you want to express for
> readability?
>
> Cor
>
>
>[/color] |  | Similar Visual Basic .NET bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,510 network members.
|