Tuesday, February 9, 2016

Learning a little TypeScript - Implementing a generic Queue collection

Not being much of a JavaScript guy, other than dabbling when I needed a little client side script, I thought I should probably join the rest of the world and move away from the comfort of C/C++ and C#. Taking baby steps I tried my hand at TypeScript first. I thought others might find my first attempt useful.

Wanting to try out classes and generics, I decided to implement a toy collection class. The snippet  is loosely based on the .NET generic Queue collection interface and implements a similar collection in TypeScript.

Without further ado, here is my very first TypeScript snippet.



And here is a quick and dirty sample showing how the queue could be used


No comments:

Post a Comment