0

i'm new in using VB, so i'm not quite familiar with it.. if any of you use cpp, i'm sure that you know STL in cpp, like vector and stack..
does VB has that kind of STL too? i really need good data structure using VB now, and it will kill me if i have to code all necessary data structure like list, stack, vector, etc :((

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by AirGear
0

Look at the System.Collections.Generic namespace. There are lists, stacks, key/value dictionaries, etc.

VB usage example:

Imports System.Collections.Generic

Module Module1

    Sub Main()

        Dim names As List(Of String) = New List(Of String)
        names.Add("Jack")
        names.Add("Jill")

        Dim romanNumerals As Dictionary(Of Integer, String) = New Dictionary(Of Integer, String)
        romanNumerals.Add(1, "I")
        romanNumerals.Add(2, "II")
        romanNumerals.Add(3, "III")
        romanNumerals.Add(4, "IV")
        romanNumerals.Add(5, "V")
        
        'do something else 

        Console.Read()

    End Sub

End Module

As an aside, I don't use C++, so I can't rattle off specific differences, but I know there are some. You should google "templates versus generics" to see how they compare.

Edited by apegram: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.