• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 15-Day Money-Back Guarantee

VB Equivalent to C++ Collection Initializers

In VB, the keyword 'From' is used to initialize collections during construction.

C++ VB
//vector:
std::vector<int> myList = {1, 2, 3};

//unordered_map:
std::unordered_map<std::wstring, int> myD = {
    {string1, 80},
    {string2, 85}
};
'List:
Dim myList As New List(Of Integer)() From {1, 2, 3}

'Dictionary:
Dim myD As New Dictionary(Of String, Integer) From {
    {string1, 80},
    {string2, 85}
}


Use C++ to VB Converter to convert from C++ to VB.     

Additional resource: VB.NET and C++ Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.