O'Reilly - Head First C Sharp Nov 2007.pdf

(145599 KB) Pobierz
244604078 UNPDF
244604078.006.png
Head First C#
by Andrew Stellman and Jennifer Greene
Copyright © 2008 O’Reilly Media, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly Media books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles ( safari.oreilly.com ). For more information, contact our corporate/institutional sales
department: (800) 998-9938 or corporate@oreilly.com .
Series Creators:
Kathy Sierra, Bert Bates
Series Editor:
Brett D. McLaughlin
Design Editor:
Louise Barr
Cover Designers:
Louise Barr, Steve Fehler
Production Editor:
Sanders Kleinfeld
Proofreader:
Colleen Gorman
Indexer:
Julie Hawks
Page Viewers:
Quentin the whippet and Tequila the pomeranian
Printing History:
November 2007: First Edition.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. The Head First series designations,
Head First C# , and related trade dress are trademarks of O’Reilly Media, Inc.
Microsoft, Windows, Visual Studio, MSDN, the .NET logo, Visual Basic and Visual C# are registered
trademarks of Microsoft Corporation.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark
claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and the authors assume no
responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
No bees, space aliens, or comic book heroes were harmed in the making of this book.
ISBN-10: 0-596-51482-4
ISBN-13: 978-0-596-51482-2
[M]
244604078.007.png 244604078.008.png 244604078.009.png
244604078.001.png
table of contents
Table of Contents (Summary)
Intro
xxix
1
Get productive with C#: Visual Applications, in 10 minutes or less
1
2
It’s All Just Code: Under the hood
43
3
Objects Get Oriented: Making code make sense
85
4
Types and References: It’s 10:00. Do you know where your data is?
123
C# Lab 1: A Day at the Races
163
5
Encapsulation: Keep your privates… private
173
6
Inheritance: Your object’s family tree
205
7
Interfaces and abstract classes: Making classes keep their promises
251
8
enums and collections: Storing lots of data
309
C# Lab 2: The Quest
363
9
Reading and writing files: Save the byte array, save the world
385
10
Exception handling: Putting Out Fires Gets Old
439
11
events and delegates: What Your Code Does When You’re Not Looking
483
12
Review and preview: Knowledge, Power, and Building Cool Stuff
515
13
Controls and graphics: Make it pretty
563
14
Captain Amazing: The Death of the Object
621
15
LINQ: Get control of your data
653
C# Lab 3: Invaders
681
Table of Contents (the real thing)
Intro
Your brain on C#. You’re sitting around trying to learn something, but
your brain keeps telling you all that learning isn’t important . Your brain’s saying,
“Better leave room for more important things, like which wild animals to avoid and
whether nude archery is a bad idea.” So how do you trick your brain into thinking
that your life really depends on learning C#?
Who is this book for?
xxx
We know what you’re thinking
xxxi
Metacognition
xxxiii
Bend your brain into submission
xxxv
What you need for this book
xxxvi
Read me
xxxii
The technical review team
xxxiv
Acknowledgments
xxxv
ix
table of contents
get productive with C#
1 Want to build great programs really fast?
With C#, you’ve got a powerful programming language and a valuable tool
at your fingertips. With the Visual Studio IDE , you’ll never have to spend hours
writing obscure code to get a button working again. Even better, you’ll be able
to focus on getting your work done , rather than remembering which method
parameter was for the name for a button, and which one was for its label .
Sound appealing? Turn the page, and let’s get programming.
Why you should learn C# 2
C# and the Visual Studio IDE make lots of things easy 3
Help the CEO go paperless 4
Get to know your users’ needs before you startbuilding your program 5
Here’s what you’re going to build
6
What you do in Visual Studio…
8
What Visual Studio does for you…
8
Develop the user interface
12
Visual Studio, behind the scenes
14
Add to the auto-generated code
15
You can already run your application
16
We need a database to store our information
18
Creating the table for the Contact List
20
The blanks on contact card are columns in our People table
22
Finish building the table
25
Diagram your data so your application can access it
26
Insert your card data into the database
28
Connect your form to your database objects with a data source
30
Add database-driven controls to your form
32
Good apps are intuitive to use
34
How to turn YOUR application into EVERYONE’S application
37
Give your users the application
38
You’re NOT done: test your installation
39
You built a complete data-driven application
40
x
Visual Applications, in 10 minutes or less
244604078.002.png 244604078.003.png 244604078.004.png 244604078.005.png
Zgłoś jeśli naruszono regulamin