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 Intege
No; there is no such thing as a constant array in CLI; arrays are always mutable. Perhaps a ReadOnlyCollection
In C# (so presumably similar in VB) you can do something like:
private readonly static ReadOnlyCollection fixedStrings
= new ReadOnlyCollection(
new string[] { "apple", "banana", "tomato", "orange" });
Which gives you a static (=shared) non-editable, re-usable collection. This works especially well if the method accepts IList
, IEnumerable
, etc (rather than an array, T[]
).