List of list (of string) values ​​within a parameter

simple question: how to pass directly values ​​inside a parameter of some function, for example:

MyFunction(byval myvariable as List(Of String))
...

      

Now I want to pass something like this (it doesn't work):

MyFunction(New List(Of String) { "somevalue1", "somevalue2", "somevalue3" })

      

+3


source to share


1 answer


In VB.NET, you need to use From

in Collection-Initializers :



MyFunction(New List(Of String) From { "somevalue1", "somevalue2", "somevalue3" })

      

+3


source







All Articles