Thomas’ Developer Blog

February 1, 2008

Queue class

Filed under: Asp.Net Framework 2.0 — Tags: , , , , , , , — sanzon @ 5:41 am

This is a really useful class I decided to throw in there. 

 With the Queue Class you can free up a lot of space on your server and really help increase performance without lagging it down with an array or a ton of other variables.

The VB code is simple:

 Dim myQueue As New Queue()

myqueue.Enqueue(“Hello”)
myqueue.Enqueue(“GoodBye”)

 To retrieve the information you simply use the code:

myqueue.Dequeue()

that will retrieve the information and then delete it from the list!  If you just want to “peek” well….

myqueue.peek()

yes i know real creative!  Anyway it works real nice when you have to simply make a quick list and run through it.  A good example in my case is with parameters and odbc connections.  You have to use ? to place each parameter, but it becomes a nightmare since you have to make sure everything goes in order.

So if you make a customer select string command you can simply store the values into the queue than as you call them to place into paramters you can delete them right away!  Best part is you don’t need to worry about using so many loops!  Plus you can store several values in a row.

Example: odbc database type, character amount, and value.

As you go through you can use a case statement (you will have to use ctype to conver to string btw) and than run through the switch statement to place the correct datatype.  Best part is since you used dequeue at the start you don’t have to use it again and it switches right over to the next!  So much less coding!  Than you query the queue 2 more times and get the length of the datatype and the value. 

You simply loop it than and there you go!  Everything is neat and in order!  Plus you saved a lot of space on your server.

Advertisements

2 Comments »

  1. This database is compatible with .NET, Silverlight, Windows Phone, Mono, Monodroid, and Monotouch:
    http://www.kellermansoftware.com/p-43-ninja-net-database-pro.aspx

    Comment by Sammie Asava — April 4, 2013 @ 10:36 am

  2. Right now it seems like BlogEngine is the best blogging platform available right now.

    (from what I’ve read) Is that what you’re using on your blog?

    Comment by how to configure best cable best dsl modem for xbox — September 23, 2014 @ 6:25 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: