Thứ Tư, 12 tháng 3, 2014

Tài liệu Head First C# pptx


LINK DOWNLOAD MIỄN PHÍ TÀI LIỆU "Tài liệu Head First C# pptx": http://123doc.vn/document/1035381-tai-lieu-head-first-c-pptx.htm


Praise for other Head First books
“I received the book yesterday and started to read it…and I couldn’t stop. This is definitely très ‘cool.’ It
is fun, but they cover a lot of ground and they are right to the point. I’m really impressed.”
— Erich Gamma, IBM Distinguished Engineer, and co-author of
Design Patterns
“One of the funniest and smartest books on software design I’ve ever read.”
— Aaron LaBerge, VP Technology, ESPN.com
“What used to be a long trial and error learning process has now been reduced neatly into an engaging
paperback.”
— Mike Davidson, CEO, Newsvine, Inc.
“Elegant design is at the core of every chapter here, each concept conveyed with equal doses of
pragmatism and wit.”
— Ken Goldstein, Executive Vice President, Disney Online
“I ♥ Head First HTML with CSS & XHTML—it teaches you everything you need to learn in a ‘fun
coated’ format.”
— Sally Applin, UI Designer and Artist
“Usually when reading through a book or article on design patterns, I’d have to occasionally stick myself
in the eye with something just to make sure I was paying attention. Not with this book. Odd as it may
sound, this book makes learning about design patterns fun.

“While other books on design patterns are saying ‘Bueller… Bueller… Bueller…’ this book is on the float
belting out ‘Shake it up, baby!’”
— Eric Wuehler
“I literally love this book. In fact, I kissed this book in front of my wife.”
— Satish Kumar
Other related books from O’Reilly
Programming C# 4.0
C# 4.0 in a Nutshell
C# Essentials
C# Language Pocket Reference
Other books in O’Reilly’s Head First series
Head First Java
Head First Object-Oriented Analysis and Design (OOA&D)
Head Rush Ajax
Head First HTML with CSS and XHTML
Head First Design Patterns
Head First Servlets and JSP
Head First EJB
Head First PMP
Head First SQL
Head First Software Development
Head First JavaScript
Head First Ajax
Head First Statistics
Head First Physics
Head First Programming
Head First Ruby on Rails
Head First PHP & MySQL
Head First Algebra
Head First Data Analysis
Head First Excel
Beijing • Cambridge • Kln • Sebastopol • Taipei • Tokyo
Andrew Stellman
Jennifer Greene
Head First
C#
Second Edition
Wouldn’t it be dreamy
if there was a C# book that
was more fun than endlessly
debugging code? It’s probably
nothing but a fantasy
Head First C#
Second Edition
by Andrew Stellman and Jennifer Greene
Copyright © 2010 Andrew Stellman and Jennifer Greene. 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 (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales
department: (800) 998-9938 or corporate@oreilly.com.
Series Creators: Kathy Sierra, Bert Bates
Cover Designers: Louise Barr, Karen Montgomery
Production Editor: Rachel Monaghan
Proofreader: Emily Quill
Indexer: Lucie Haskins
Page Viewers: Quentin the whippet and Tequila the pomeranian
Printing History:
November 2007: First Edition.
May 2010: Second 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: 978-1-449-38034-2
[SB]
This book is dedicated to the loving memory of Sludgie the Whale,
who swam to Brooklyn on April 17, 2007.
You were only in our canal for a day,
but you’ll be in our hearts forever.
viii
Jennifer Greene studied philosophy in
college but, like everyone else in the field, couldn’t
find a job doing it. Luckily, she’s a great software
engineer, so she started out working at an online
service, and that’s the first time she really got a
good sense of what good software development
looked like.
She moved to New York in 1998 to work on
software quallity at a financial software company.
She managed a team of testers at a really cool
startup that did artificial intelligence and natural
language processing.
Since then, she’s traveled all over the world to work
with different software teams and build all kinds of
cool projects.
She loves traveling, watching Bollywood movies,
reading the occasional comic book, playing PS3
games (especially LittleBigPlanet!), and owning a
whippet.
Andrew Stellman, despite being raised a
New Yorker, has lived in Pittsburgh twice. The
first time was when he graduated from Carnegie
Mellon’s School of Computer Science, and then
again when he and Jenny were starting their
consulting business and writing their first book for
O’Reilly.
When he moved back to his hometown, his first
job after college was as a programmer at EMI-
Capitol Records—which actually made sense,
since he went to LaGuardia High School of
Music and Art and the Performing Arts to study
cello and jazz bass guitar. He and Jenny first
worked together at that same financial software
company, where he was managing a team of
programmers. He’s had the privilege of working
with some pretty amazing programmers over the
years, and likes to think that he’s learned a few
things from them.
When he’s not writing books, Andrew keeps
himself busy writing useless (but fun) software,
playing music (but video games even more),
experimenting with circuits that make odd noises,
studying taiji and aikido, having a girlfriend
named Lisa, and owning a pomeranian.
the authors
Jenny and Andrew have been building software and writing about software engineering together since they
first met in 1998. Their first book,
Applied Software Project Management
, was published by O’Reilly in
2005. They published their first book in the Head First series,
Head First PMP
, in 2007.
They founded Stellman & Greene Consulting in 2003 to build a really neat software project for
scientists studying herbicide exposure in Vietnam vets. When they’re not building software or writing
books, they do a lot of speaking at conferences and meetings of software engineers, architects and
project managers.
Check out their blog,

Building Better Software
:
http://www.stellman-greene.com
Jenny
Andrew
Thanks for buying our book! We really
love writing about this stuff, and we
hope you get a kick out of reading it…
…because we know
you’re going to have a
great time learning C#.
This photo (and the photo of the
Gowanus Canal) by Nisha Sondhe
table of contents
ix
Table of Contents (Summary)
Table of Contents (the real thing)
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#?
Intro
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 xxxvii
The technical review team xxxviii
Acknowledgments xxxix
Intro xxix
1 Get productive with C#: Visual Applications, in 10 minutes or less 1
2 It’s All Just Code: Under the hood 41
3 Objects: Get Oriented: Making code make sense 85
4 Types and References: It’s 10:00. Do you know where your data is? 125
C# Lab 1: A Day at the races 169
5 Encapsulation: Keep your privates… private 179
6 Inheritance: Your object’s family tree 215
7 Interfaces and abstract classes: Making classes keep their promises 269
8 Enums and collections: Storing lots of data 327
C# Lab 2: The Quest 385
9 Reading and Writing Files: Save the byte array, save the world 407
10 Exception Handling: Putting out fires gets old 463
11 Events and Delegates: What your code does when you’re not looking 507
12 Review and Preview: Knowledge, power, and building cool stuff 541
13 Controls and Graphics: Make it pretty 589
14 Captain Amazing: The Death of the Object 647
15 LINQ: Get control of your data 685
C# Lab 3: Invaders 713
i Leftovers: The top 11 things we wanted to include in this book 735
table of contents
x
Visual Applications, in 10 minutes or less
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 of a button, and which one was for its label. Sound
appealing? Turn the page, and let’s get programming.
get productive with C#
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 start
building your program 5
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
We need a database to store our information 18
The IDE created a database 19
SQL is its own language 19
Creating the table for the Contact List 20
Finish building the table 25
Insert your card data into the database 26
Connect your form to your database objects with a data source 28
Add database-driven controls to your form 30
How to turn YOUR application into EVERYONE’S application 35
Give your users the application 36
You’re NOT done: test your installation 37
You’ve built a complete data-driven application 38
table of contents
xi
Under the hood
You’re a programmer, not just an IDE user.
You can get a lot of work done using the IDE. But there’s only so far it
can take you. Sure, there are a lot of repetitive tasks that you do when
you build an application. And the IDE is great at doing those things for
you. But working with the IDE is only the beginning. You can get your
programs to do so much more—and writing C# code is how you do it.
Once you get the hang of coding, there’s nothing your programs can’t do.
it’s all just code
2
When you’re doing this… 42
…the IDE does this 43
Where programs come from 44
The IDE helps you code 46
When you change things in the IDE, you’re also changing
your code 48
49
Anatomy of a program 50
Your program knows where to start 52
53
Two classes can be in the same namespace 59
Your programs use variables to work with data 60
C# uses familiar math symbols 62
Use the debugger to see your variables change 63
Loops perform an action over and over 65
Time to start coding 66
if/else statements make decisions 67
Set up conditions and see if they’re true 68
table of contents
xii
3
Making Code Make Sense
Every program you write solves a problem.
When you’re building a program, it’s always a good idea to start by thinking about what
problem your program’s supposed to solve. That’s why objects are really useful. They
let you structure your code based on the problem it’s solving, so that you can spend your
time thinking about the problem you need to work on rather than getting bogged down in
the mechanics of writing code. When you use objects right, you end up with code that’s
intuitive to write, and easy to read and change.
objects: get oriented!
new Navigator()
new Navigator()
new Navigator()
How Mike thinks about his problems 86
How Mike’s car navigation system thinks about his problems 87
Mike’s Navigator class has methods to set and modify routes 88
Use what you’ve learned to build a program that uses a class 89
90
Mike can use objects to solve his problem 92
You use a class to build an object 93
When you create a new object from a class, it’s called an instance
of that class 94
A better solution…brought to you by objects! 95
An instance uses fields to keep track of things 100
Let’s create some instances! 101
What’s on your program’s mind 103
You can use class and method names to make your code intuitive 104
Give your classes a natural structure 106
Class diagrams help you organize your classes so they make sense 108
Build a class to work with some guys 112
Create a project for your guys 113
Build a form to interact with the guys 114
There’s an easier way to initialize objects 117

Không có nhận xét nào:

Đăng nhận xét