Hast Table - Dictionary Learn programming Visual Basic (VB.net)



Lesson:

Dynamic Memory Management


Exercise:

Hast Table - Dictionary


Objetive:

Submit your dictionary here using a hash table.


Code:

Imports System
Imports System.Collections
Namespace TableHash
    Class Program
        Private Shared Sub Main(ByVal args As String())
            Dim myList As Hashtable = New Hashtable()
            myList.Add("white", "blanco")
            myList.Add("black", "negro")
            Console.WriteLine("The size is: " & myList.Count)
            Console.WriteLine("Contenido:")
            Dim miEnumerador As IDictionaryEnumerator = myList.GetEnumerator()

            While miEnumerador.MoveNext()
                Console.WriteLine("{0} = {1}", miEnumerador.Key, miEnumerador.Value)
            End While

            If myList.ContainsKey("orange") Then
                Console.WriteLine(myList("orange"))
            End If
        End Sub
    End Class
End Namespace



Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.