Collection Examples

Collection Queue Example

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Collections
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms

Namespace CollectionQueueExample
    Public Partial Class Form1
        Inherits Form

        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
            Dim days As Queue = New Queue()
            days.Enqueue("Sunday")
            days.Enqueue("Monday")
            days.Enqueue("Tuesday")
            days.Enqueue("Wednsday")
            days.Enqueue("Thursday")
            days.Enqueue("Friday")
            days.Enqueue("Saturday")
            MessageBox.Show(days.Dequeue().ToString())

            If days.Contains("Monday") Then
                MessageBox.Show("The queue contains Monday")
            Else
                MessageBox.Show("Does not match any entries")
            End If
        End Sub
    End Class
End Namespace

©Copyright 2016 All Rights Reserved LearnDotNetHome.com