The Bonus Site for
C# 2008
For Dummies and C# 2010 All-In-One For Dummies
csharp102.info

If my book, C# 2008 For Dummies, is "C# 101," then this site is "C# 102" (and the newest edition, C# 2010 All-In-One For Dummies is C# 103!) This site is dedicated to supporting the book by providing lots of extras. I try to update the site frequently, adding mainly articles and new C# code. See the link at the top right of this page to NEW ON THE SITE.
The 2008 edition updates the previous edition (2005) and the 2010
edition updates the 2008 edition (funny how these things go)--
but more than that, both books are heavily revised to add more C#
info for you! What's really hot in this edition? See the sections
What's Hot in the New C# 3.0? and
What's Hot in the Newer C# 4.0 below.
For a table mapping chapters in the 2010 edition to the 2008 edition, click here.
(Note about page display. See bottom of page.*)
For Beginners | For Experienced Programmers
I'll be adding new content gradually as I get it developed. Note that this site contains extra materials, but you can also go to www.dummies.com to find information about lots of other For Dummies programming books.
Go to TopThis section is for those new to C#, or even new to programming.
C# is a programming language -- a specialized "language" for writing programs, sets of instructions for the computer to carry out. C# has been around now for some six or seven years, a part of Microsoft's .NET initiative. .NET amounts to the current way to program for Windows. C# is based on earlier languages, including Java, C, and C++. C# programs consist of objects that communicate with each other, supplying services to each other.
Programs contain a structured sequence of statements; each statement stores data in a variable, or makes a decision, or manipulates some data. An object-oriented program (OOP) packages bits of data into objects, such as a Student object in a school management program. Objects also know how to operate on their own data. For example, a Student object might call upon an I/O object to write its information into a permanent disk file.
To illustrate, a program representing a game of tic tac toe might consist of a Game object to manage the players and their turn-taking, a Board object to store information about where the Xs and Os have been placed, and so on.
Every program starts off in a Main method, so for the tic tac
toe game, Main might create a Game object and call its Play
method, which would wait for the first (human) player to mark an
X in a square, then record that X in the Board object and see
if that might have been a winning move. Then Play would wait
for the O player, and so on, back and forth in a loop until
one player wins -- or the Board fills up without either player
having won.
This section is for those with programming experience, maybe even previous C# experience, who want to learn C# or find out what's new in the latest version. If you're new to C#, be sure to check out the annotated Table of Contents. If you already know some C#, take a look at the "What's Hot" sections for C# 2008 and C# 2010 below.
Well, suppose you have an array of numbers { 0, 2, 4, 7, 3, 9 } and you'd like to pick out the even numbers in the array, resulting in a new array containing just 0, 2, and 4. With a simple "query" expression, you can get that list -- no need for a loop. You just specify your query with the new Language Integrated Query (LINQ) functionality in C#. Chapter 17 in the book takes you through writing some pretty cool LINQ queries on data in C# arrays and collections. You can even write very similar queries with LINQ on data in databases or in Extensible Markup Language (XML) files (although we don't cover database or XML topics in the book). Here's the even-numbers query I mentioned above:
var evens = from n in numbers
where n % 2 == 0
select n;
The book covers these topics except for the two that contain links to outside information.
C# 4.0 adds new features that help you:
*Page Display Note: If you get browser messages about blocking scripts or ActiveX controls from running on the page, please know that these pages contain no harmful code.