Inicialización de lista en línea en VB.NET [duplicado]


Posible Duplicado:
Sintaxis de inicialización de colección en Visual Basic 2008?

¿Cómo se traduce el siguiente código C # a VB.NET?

var theVar = new List<string>{"one", "two", "three"};
 110
Author: Community, 2010-04-13

2 answers

Utilice esta sintaxis para VB.NET compatibilidad 2005/2008:

Dim theVar As New List(Of String)(New String() {"one", "two", "three"})

Aunque el VB.NET 2010 syntax es más bonita.

 146
Author: Prutswonder,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 11:47:30

Los inicializadores de colección están solo disponibles en VB.NET 2010, publicado 2010-04-12:

Dim theVar = New List(Of String) From { "one", "two", "three" }
 188
Author: SLaks,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-03-18 14:46:31