Just some basic questions because none of my reference manuals cover
this explicitly:
1) If you want have an argument as an array of integers would this
be the correct declaration?
Function foo(bar() as Integer) as Integer
..
End Function
2) If you wanted to *return* an array of integers from the function
would this declaration be correct?
Function foo(bar as Integer) as Integer()
..
End Function
TIA...Blue Streak,
Yep, you've got it.
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Blue Streak" <rdlebreton@.hotmail.com> wrote in message
news:1134415138.256287.261280@.g44g2000cwa.googlegroups.com...
> Just some basic questions because none of my reference manuals cover
> this explicitly:
> 1) If you want have an argument as an array of integers would this
> be the correct declaration?
> Function foo(bar() as Integer) as Integer
> ...
> End Function
> 2) If you wanted to *return* an array of integers from the function
> would this declaration be correct?
> Function foo(bar as Integer) as Integer()
> ...
> End Function
> TIA...
>
Since you went to the trouble of writing it out here, you could have simply
tried it out. Your code looks fine, except I think () should come after
integer not bar in the 1st example
For the parameters, you could declare it as ParamArray which would let you
pass in 1 value, great replacement for overloading (in some cases)
Function foo (ParamArray bar as integer()
end function
you can now call foo with either a single value, or an array, or a comma
separated list
foo(1)
foo(arr)
foo(1,2,3,4,5)
ParramArray _must_ be the last parameter of a function.
Karl
MY ASP.Net tutorials
http://www.openmymind.net/
"Blue Streak" <rdlebreton@.hotmail.com> wrote in message
news:1134415138.256287.261280@.g44g2000cwa.googlegroups.com...
> Just some basic questions because none of my reference manuals cover
> this explicitly:
> 1) If you want have an argument as an array of integers would this
> be the correct declaration?
> Function foo(bar() as Integer) as Integer
> ...
> End Function
> 2) If you wanted to *return* an array of integers from the function
> would this declaration be correct?
> Function foo(bar as Integer) as Integer()
> ...
> End Function
> TIA...
>
Karl,
In VB.NET the parentheses may be placed just after the parameter name or
after the type declaration. It's up to the developer, but both ways work.
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%23fDEHL1$FHA.316@.TK2MSFTNGP10.phx.gbl...
> Since you went to the trouble of writing it out here, you could have
> simply tried it out. Your code looks fine, except I think () should come
> after integer not bar in the 1st example
> For the parameters, you could declare it as ParamArray which would let
> you pass in 1 value, great replacement for overloading (in some cases)
> Function foo (ParamArray bar as integer()
> end function
> you can now call foo with either a single value, or an array, or a comma
> separated list
> foo(1)
> foo(arr)
> foo(1,2,3,4,5)
> ParramArray _must_ be the last parameter of a function.
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
> "Blue Streak" <rdlebreton@.hotmail.com> wrote in message
> news:1134415138.256287.261280@.g44g2000cwa.googlegroups.com...
>
0 comments:
Post a Comment