t3-Arrays n Hashes

Arrays and Hashes can be easily thought of as two different styles of addressing information for the computer to memeorise. An Array has a straight numrical list of addresses, from 0 to as mcuh as you like, where it can put something.

Maybe it would be easy to think of houses on a street, each has it's own number so that the postie can deliver the right thing to the right people.

To take this analogy a bit further; -An array is like what the postal service was a hundred years ago, or what rural delivery is like in most small areas in NZ today. Instead of using a house number for an address, things can be addressed to "BuKKa the old blues singer" or in modern Rural Delivery in NZ you just right the persons name care of the district they are from and the letter gets to them. These two styles of addreess are most easily described as a "Quantatative" verses a "Qualitative" address.

An example of creating a numeric, quantatative Array in C# would look like:

int[] powersOfTen = {1,10,100};

This creates an Array called 'powersOfTen' containing the values: 1, 10 and 100, stored in locations [0], [1] and [2] and can be recalled byquoting those addresses.

An example of a Hash which uses a qualitative address is:

var hashtable = new Hashtable() { {"firstName", "Frank"}, {"lastName", "Hardy"}, {"age", 25} };

The HashTable is called, unremarkably "Hashtable", and has the contents of "Frank","Hardy" and the interger 25. These are stored in addresses "firstName", "lastName" and "age". Unlike Array's the type of data being entered doesn't have to be stipulated beforehand, nor does it neeed to be of consistant type.

Blog Index

CSS Cheat_Sheet

Culture Blog Week 1

Culture Blog Week 3

Culture Blog Week 4

Culture Blog Week 5

Culture Blog Week 6

Culture Blog Week 7

Culture Blog Week 8

Technical Week 1

Technical Week 2

Technical Week 3

Technical Week 4

Technical Week 5

Technical Week 6

Technical Week 7

Phill and Nary pair a web page in an hour

Main Index