The Code for today's show is available below: Social App
Thanks to Joe Maruschek for showing us why the MVVM pattern works so well!
Lists & Array (Dictionary, Hash) Collections * Often, we want to create and manage groups of objects that are related to each other in some way. The .NET Framework gives us classes that have been specifically designed for data storage and retrieval. Arrays are fine when we are working with a FIXED number of uniformly typed objects -- But they don't work so well when we start working with an indeterminate number of objects, or with objects that are not strongly typed. Unlike Arrays, the group of objects with a COLLECTION can grow and shrink DYNAMICALLY. ** To use Collections, we add the Include: "using System.Collections;" Arrays * An Array is a way to store values within an "object" that uses a single identifer with an "index" value to point to an particular value within the index * n.b --- An array is an OBJECT. * In C#, arrays can be fixed or dynamic -- You can set the LENGTH of the array -- OR you can make it of an undetermined size. Dynamic Array int TWiTArray; * This will create a DYNAMIC array of Integers called "TWiTArray" of an undetermined length Static Array "int C101Array; C101Array = new int;" This creates a FIXED array of integers called "C101Array" with 100 values, from 0 to 99 But it Doesn't have to be Integer Values double, char bool, string --- these are all types of arrays you can make. Lists * A "List" is an array that can be dynamically resized. -- This means that you don't need to determine how big the dataset will eventually be -- The list will automatically grow as you add more values. Dictionaries: * Dictionaries let us create objects with elements that are searchable by keys Hash: * A Hashtable allow us to look up elements via their hashes.
Get in Touch With Us!
* Subscribe and get Coding 101 automatically at TWiT.tv! * Follow PadreSJ and Snubs on Twitter. * Watch the show live and join the chatroom every Thursday at 1:30pm PST. * Email us at Padre@twit.tv and Shannon@twit.tv. * Join our Google+ Community! * Check out our transcripts. Official rules for the Squarespace Giveaway Sweepstakes are at http://inside.twit.tv/contests. Bandwidth for Coding 101 is provided by Cachefly.