I know that you can easily pass an array to a function, for example, 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 of functions to VB.NET?
For example, in PHP you can write:
function SomeFunction($array) { for($i=0;$i<count($array);$i++) { echo($array[$i]); } } function Test() { SomeFunction(array("some", "array", "members"));
So, to repeat: is there a way to pass a constant array directly to functions in VB.NET? Is there any benefit to this? I guess a few bytes of memory could be saved.
PS :.
SomeFunction({"some", "array", "member"}) ' This obviously gives a syntax error
source share