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 :((

Recommended Answers

All 2 Replies

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.

ok dude, i will try that.. thank for your response..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.