R
Rob Nicholson
Consider the following example class:
Public Class ExampleClass
ReadOnly Property HelloWorld() As String
Get
Return "Hello, World"
End Get
End Property
End Class
And a subroutine:
Sub DoSomething(ec as ExampleClass)
End Sub
You can invoke this using:
DoSomething(New ExampleClass)
In that you don't need to create the parameter via variable. Is the same
possible with arrays as parameters:
Sub DoSomething(Words() As String)
End Sub
This can be invoked like this:
Dim MyWords() = {"Hello", "World", "Goodbye"}
DoSomething MyWords
However, is it possible to create an array on the fly like with something
like this:
DoSomething(New String()={"Hello","World","Goodbye"})
This doesn't work but gives an idea.
Cheers, Rob.
PS. I know about ParamArray Words() As String.
Public Class ExampleClass
ReadOnly Property HelloWorld() As String
Get
Return "Hello, World"
End Get
End Property
End Class
And a subroutine:
Sub DoSomething(ec as ExampleClass)
End Sub
You can invoke this using:
DoSomething(New ExampleClass)
In that you don't need to create the parameter via variable. Is the same
possible with arrays as parameters:
Sub DoSomething(Words() As String)
End Sub
This can be invoked like this:
Dim MyWords() = {"Hello", "World", "Goodbye"}
DoSomething MyWords
However, is it possible to create an array on the fly like with something
like this:
DoSomething(New String()={"Hello","World","Goodbye"})
This doesn't work but gives an idea.
Cheers, Rob.
PS. I know about ParamArray Words() As String.