Chapter 10 — Collections

SAMS CSHARP 4.0 (Page 172) 03/03/2011, 10:43 PM

* Initialize a Connection

List<int> list = new List<int>() {1, 2, 3, 4,5 };

Dictionary<int, string> dict = new Dictionary<int, string> )() {
{1, “one”},
{2, “two”}

* Iterate over a collection independently of its implementation

You want to access all of a collection’s objects independently from how the collection is implemented.

Rather than looping using index or key, use FOREACH.

Post a comment or leave a trackback: Trackback URL.

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: