Hello everybody,
I know that you can easily pass an array to a function, like the code below shows
Private Sub SomeFunction(ByVal PassedArray() As String)
For i As Integer = 0 To PassedArray.Count - 1
Debug.WriteLine(PassedArray(i))
Next
End Sub
Public Sub Test()
Dim MyArray As String() = {"some", "array", "members"}
SomeFunction(MyArray)
End Sub
But is there a way to pass a constant array to a function in VB .Net, for instance in PHP you could write
function SomeFunction($array)
{
for($i=0;$i<count($array);$i++)
{
echo($array[$i]);
}
}
function Test()
{
SomeFunction(array("some", "array", "members")); // works for PHP
}
So to reiterate: Is there any way to pass a constant array directly to a function in VB .Net? Is there any benefit in doing so? I imagine a few bytes of memory could be spared.
PS.
SomeFunction({"some", "array", "member"}) ' this obviously gives a syntax error