深入浅出C#(第3版,影印版)
Andrew Stellman, Jennifer Greene
出版时间:2014年06月
页数:1100
“如果你想深入学习C#并且在此过程保持愉悦的话,这本书就适合你。”
——Andy Parker,初出茅庐的 C#程序员
“《深入浅出C#》将会帮助各类初学者高效掌握C#和.NET Framework。”
——Chris Burrows,Microsoft C#编译,团队开发人员
“《深入浅出C#》让我可以快速开展工作中的第一个大规模C#开发项目——我强烈推荐它。”
——Shalewa Odusanya,技术客户经理,Google

你可以从这本书里学到什么?
《深入浅出C#》对于使用C#,XAML,.NET Framework和Visual Studio的编程者来说是一个全面的学习体验。它为你贴身打造,从第一章起就让你参与其中,你将构建一个具有完整功能的视频游戏。之后,你将学习关于类和面向对象编程、绘制图形和动画、使用LINQ查询你的数据以及将数据序列化到文件方面的知识。而你将通过创建游戏、解决难题和亲自动手完成项目来达到这一目的。等你完成这一切之后,你就会成为一名合格的C#程序员,而且你可以享受整个过程!

这本书为何如此出色?
我们认为你的时间如此宝贵以至于不应该花费在为新概念伤脑筋上面。《深入浅出C#》运用最新的认知科学和学习理论打造多感官的学习体验,运用适合大脑工作方式的直观的格式编排,而不是令人昏昏欲睡的密密麻麻的文字。
  1. Chapter 1: Start Building with C#: Build something cool, fast!
  2. Why you should learn C#
  3. C# and the Visual Studio IDE make lots of things easy
  4. What you do in Visual Studio...
  5. What Visual Studio does for you...
  6. Aliens attack!
  7. Only you can help save the Earth
  8. Here’s what you’re going to build
  9. Start with a blank application
  10. Set up the grid for your page
  11. Add controls to your grid
  12. Use properties to change how the controls look
  13. Controls make the game work
  14. You’ve set the stage for the game
  15. What you’ll do next
  16. Add a method that does something
  17. Fill in the code for your method
  18. Finish the method and run your program
  19. Here’s what you’ve done so far
  20. Add timers to manage the gameplay
  21. Make the Start button work
  22. Run the program to see your progress
  23. Add code to make your controls interact with the player
  24. Dragging humans onto enemies ends the game
  25. Your game is now playable
  26. Make your enemies look like aliens
  27. Add a splash screen and a tile
  28. Publish your app
  29. Use the Remote Debugger to sideload your app
  30. Start remote debugging
  31. Chapter 2: It’s all Just Code: Under the hood
  32. When you’re doing this...
  33. ...the IDE does this
  34. Where programs come from
  35. The IDE helps you code
  36. Anatomy of a program
  37. Two classes can be in the same namespace
  38. Your programs use variables to work with data
  39. C# uses familiar math symbols
  40. Use the debugger to see your variables change
  41. Loops perform an action over and over
  42. if/else statements make decisions
  43. Build an app from the ground up
  44. Make each button do something
  45. Set up conditions and see if they’re true
  46. Windows Desktop apps are easy to build
  47. Rebuild your app for Windows Desktop
  48. Your desktop app knows where to start
  49. You can change your program’s entry point
  50. When you change things in the IDE, you’re also changing your code
  51. Chapter 3: Objects: Get Oriented!: Making code make sense
  52. How Mike thinks about his problems
  53. How Mike’s car navigation system thinks about his problems
  54. Mike’s Navigator class has methods to set and modify routes
  55. Use what you’ve learned to build a program that uses a class
  56. Mike gets an idea
  57. Mike can use objects to solve his problem
  58. You use a class to build an object
  59. When you create a new object from a class, it’s called an instance of that class
  60. A better solution...brought to you by objects!
  61. An instance uses fields to keep track of things
  62. Let’s create some instances!
  63. Thanks for the memory
  64. What’s on your program’s mind
  65. You can use class and method names to make your code intuitive
  66. Give your classes a natural structure
  67. Class diagrams help you organize your classes so they make sense
  68. Build a class to work with some guys
  69. Create a project for your guys
  70. Build a form to interact with the guys
  71. There’s an easier way to initialize objects
  72. A few ideas for designing intuitive classes
  73. Chapter 4: Types and References: It’s 10:00. Do you know where your data is?
  74. The variable’s type determines what kind of data it can store
  75. A variable is like a data to-go cup
  76. 10 pounds of data in a 5-pound bag
  77. Even when a number is the right size, you can’t just assign it to any variable
  78. When you cast a value that’s too big, C# will adjust it automatically
  79. C# does some casting automatically
  80. When you call a method, the arguments must be compatible with the types of the parameters
  81. Debug the mileage calculator
  82. Combining = with an operator
  83. Objects use variables, too
  84. Refer to your objects with reference variables
  85. References are like labels for your object
  86. If there aren’t any more references, your object gets garbage-collected
  87. Multiple references and their side effects
  88. Two references means TWO ways to change an object’s data
  89. A special case: arrays
  90. Arrays can contain a bunch of reference variables, too
  91. Welcome to Sloppy Joe’s Budget House o’ Discount Sandwiches!
  92. Objects use references to talk to each other
  93. Where no object has gone before
  94. Build a typing game
  95. Controls are objects, just like any other object
  96. C# Lab: A Day at the Races
  97. Chapter 5: Encapsulation: Keep your privates... Private
  98. Kathleen is an event planner
  99. What does the estimator do?
  100. You’re going to build a program for Kathleen
  101. Kathleen’s test drive
  102. Each option should be calculated individually
  103. It’s easy to accidentally misuse your objects
  104. Encapsulation means keeping some of the data in a class private
  105. Use encapsulation to control access to your class’s methods and fields
  106. But is the RealName field REALLY protected?
  107. Private fields and methods can only be accessed from inside the class
  108. A few ideas for encapsulating classes
  109. Encapsulation keeps your data pristine
  110. Properties make encapsulation easier
  111. Build an application to test the Farmer class
  112. Use automatic properties to finish the class
  113. What if we want to change the feed multiplier?
  114. Use a constructor to initialize private fields
  115. Chapter 6: Inheritance: Your object’s family tree
  116. Kathleen does birthday parties, too
  117. We need a BirthdayParty class
  118. Build the Part y Planner version 2.0
  119. One more thing...can you add a $100 fee for parties over 12?
  120. When your classes use inheritance, you only need to write your code once
  121. Build up your class model by starting general and getting more specific
  122. How would you design a zoo simulator?
  123. Use inheritance to avoid duplicate code in subclasses
  124. Different animals make different noises
  125. Think about how to group the animals
  126. Create the class hierarchy
  127. Every subclass extends its base class
  128. Use a colon to inherit from a base class
  129. We know that inheritance adds the base class fields, properties, and methods to the subclass...
  130. A subclass can override methods to change or replace methods it inherited
  131. Any place where you can use a base class, you can use one of its subclasses instead
  132. A subclass can hide methods in the superclass
  133. Use the override and virtual keywords to inherit behavior
  134. A subclass can access its base class using the base keyword
  135. When a base class has a constructor, your subclass needs one, too
  136. Now you’re ready to finish the job for Kathleen!
  137. Build a beehive management system
  138. How you’ll build the beehive management system
  139. Use inheritance to extend the bee management system
  140. Chapter 7: Interfaces and Abstract Classes: Making classes keep their promises
  141. Let’s get back to bee-sics
  142. We can use inheritance to create classes for different types of bees
  143. An interface tells a class that it must implement certain methods and properties
  144. Use the interface keyword to define an interface
  145. Now you can create an instance of NectarStinger that does both jobs
  146. Classes that implement interfaces have to include ALL of the interface’s methods
  147. Get a little practice using interfaces
  148. You can’t instantiate an interface, but you can reference an interface
  149. Interface references work just like object references
  150. You can find out if a class implements a certain interface with “is”
  151. Interfaces can inherit from other interfaces
  152. The RoboBee 4000 can do a worker bee’s job without using valuable honey
  153. is tells you what an object implements; as tells the compiler how to treat your object
  154. A CoffeeMaker is also an Appliance
  155. Upcasting works with both objects and interfaces
  156. Downcasting lets you turn your appliance back into a coffee maker
  157. Upcasting and downcasting work with interfaces, too
  158. There’s more than just public and private
  159. Access modifiers change visibility
  160. Some classes should never be instantiated
  161. An abstract class is like a cross between a class and an interface
  162. Like we said, some classes should never be instantiated
  163. An abstract method doesn’t have a body
  164. Polymorphism means that one object can take many different forms
  165. Chapter 8: Enums and Collections: Storing lots of data
  166. Strings don’t always work for storing categories of data
  167. Enums let you work with a set of valid values
  168. Enums let you represent numbers with names
  169. We could use an array to create a deck of cards...
  170. Arrays are hard to work with
  171. Lists make it easy to store collections of...anything
  172. Lists are more flexible than arrays
  173. Lists shrink and grow dynamically
  174. Generics can store any type
  175. Collection initializers are similar to object initializers
  176. Let’s create a List of Ducks
  177. Lists are easy, but SORTING can be tricky
  178. IComparable<Duck> helps your list sort its ducks
  179. Use IComparer to tell your List how to sort
  180. Create an instance of your comparer object
  181. IComparer can do complex comparisons
  182. Overriding a ToString() method lets an object describe itself
  183. Update your foreach loops to let your Ducks and Cards print themselves
  184. You can upcast an entire list using IEnumerable
  185. You can build your own overloaded methods
  186. Use a dictionary to store keys and values
  187. The dictionary functionality rundown
  188. Build a program that uses a dictionary
  189. And yet MORE collection types...
  190. A queue is FIFO—First In, First Out
  191. A stack is LIFO—Last In, First Out
  192. Chapter 9: Reading and Writing Files: Save the last byte for me!
  193. .NET uses streams to read and write data
  194. Different streams read and write different things
  195. A FileStream reads and writes bytes to a file
  196. Write text to a file in three simple steps
  197. The Swindler launches another diabolical plan
  198. Reading and writing using two objects
  199. Data can go through more than one stream
  200. Use built-in objects to pop up standard dialog boxes
  201. Dialog boxes are just another WinForms control
  202. Dialog boxes are objects, too
  203. Use the built-in File and Directory classes to work with files and directories
  204. Use file dialogs to open and save files (all with just a few lines of code)
  205. IDisposable makes sure your objects are disposed of properly
  206. Avoid filesystem errors with using statements
  207. Trouble at work
  208. Writing files usually involves making a lot of decisions
  209. Use a switch statement to choose the right option
  210. Use a switch statement to let your deck of cards read from a file or write itself out to one
  211. Add an overloaded Deck() constructor that reads a deck of cards in from a file
  212. What happens to an object when it’s serialized?
  213. But what exactly IS an object’s state? What needs to be saved?
  214. When an object is serialized, all of the objects it refers to get serialized, too...
  215. Serialization lets you read or write a whole object graph all at once
  216. If you want your class to be serializable, mark it with the [Serializable] attribute
  217. Let’s serialize and deserialize a deck of cards
  218. .NET uses Unicode to store characters and text
  219. C# can use byte arrays to move data around
  220. Use a BinaryWriter to write binary data
  221. You can read and write serialized files manually, too
  222. Find where the files differ, and use that information to alter them
  223. Working with binary files can be tricky
  224. Use file streams to build a hex dumper
  225. StreamReader and StreamWriter will do just fine (for now)
  226. Use Stream.Read() to read bytes from a stream
  227. C# Lab: The Quest
  228. Chapter 10: Designing Windows Store Apps with XAML: Taking your apps to the next level
  229. Brian’s running Windows 8
  230. Windows Forms use an object graph set up by the IDE
  231. Use the IDE to explore the object graph
  232. Windows Store apps use XAML to create UI objects
  233. Redesign the Go Fish! form as a Windows Store app page
  234. Page layout starts with controls
  235. Rows and columns can resize to match the page size
  236. Use the grid system to lay out app pages
  237. Data binding connects your XAML pages to your classes
  238. XAML controls can contain text...and more
  239. Use data binding to build Sloppy Joe a better menu
  240. Use static resources to declare your objects in XAML
  241. Use a data template to display objects
  242. INotifyPropertyChanged lets bound objects send updates
  243. Modify MenuMaker to notify you when the GeneratedDate property changes
  244. Chapter 11: Async, Await, and Data Contract Serialization: Pardon the interruption
  245. Brian runs into file trouble
  246. Windows Store apps use await to be more responsive
  247. Use the FileIO class to read and write files
  248. Build a slightly less simple text editor
  249. A data contract is an abstract definition of your object’s data
  250. Use async methods to find and open files
  251. KnownFolders helps you access high-profile folders
  252. The whole object graph is serialized to XML
  253. Stream some Guy objects to XML files
  254. Take your Guy Serializer for a test drive
  255. Use a Task to call one async method from another
  256. Build Brian a new Excuse Manager app
  257. Separate the page, excuse, and Excuse Manager
  258. Create the main page for the Excuse Manager
  259. Add the app bar to the main page
  260. Build the ExcuseManager class
  261. Add the code-behind for the page
  262. Chapter 12: Exception Handling: Putting out fires gets old
  263. Brian needs his excuses to be mobile
  264. When your program throws an exception, .NET generates an Exception object
  265. Brian’s code did something unexpected
  266. All exception objects inherit from Exception
  267. The debugger helps you track down and prevent exceptions in your code
  268. Use the IDE’s debugger to ferret out exactly what went wrong in the Excuse Manager
  269. Uh oh—the code’s still got problems...
  270. Handle exceptions with try and catch
  271. Use the debugger to follow the try/catch flow
  272. If you have code that ALWAYS should run, use a finally block
  273. Use the Exception object to get information about the problem
  274. Use more than one catch block to handle multiple types of exceptions
  275. One class throws an exception that a method in another class can catch
  276. Bees need an OutOfHoney exception
  277. An easy way to avoid a lot of problems: using gives you try and finally for free
  278. Exception avoidance: implement IDisposable to do your own cleanup
  279. The worst catch block EVER: catch-all plus comments
  280. Temporary solutions are OK (temporarily)
  281. A few simple ideas for exception handling
  282. Brian finally gets his vacation...
  283. Chapter 13: Captain Amazing: The Death of the Object
  284. Your last chance to DO something... your object’s finalizer
  285. When EXACTLY does a finalizer run?
  286. Dispose() works with using; finalizers work with garbage collection
  287. Finalizers can’t depend on stability
  288. Make an object serialize itself in its Dispose()
  289. A struct looks like an object...
  290. ...but isn’t an object
  291. Values get copied; references get assigned
  292. Structs are value types; objects are reference types
  293. The stack vs. the heap: more on memory
  294. Use out parameters to make a method return more than one value
  295. Pass by reference using the ref modifier
  296. Use optional parameters to set default values
  297. Use nullable types when you need nonexistent values
  298. Nullable types help you make your programs more robust
  299. “Captain” Amazing...not so much
  300. Extension methods add new behavior to EXISTING classes
  301. Extending a fundamental type: string
  302. Chapter 14: Querying Data and Building Apps With Linq: Get control of your data
  303. Jimmy’s a Captain Amazing super-fan...
  304. ...but his collection’s all over the place
  305. LINQ can pull data from multiple sources
  306. .NET collections are already set up for LINQ
  307. LINQ makes queries easy
  308. LINQ is simple, but your queries don’t have to be
  309. Jimmy could use some help
  310. Start building Jimmy an app
  311. Use the new keyword to create anonymous types
  312. LINQ is versatile
  313. Add the new queries to Jimmy’s app
  314. LINQ can combine your results into groups
  315. Combine Jimmy’s values into groups
  316. Use join to combine two collections into one sequence
  317. Jimmy saved a bunch of dough
  318. Use semantic zoom to navigate your data
  319. Add semantic zoom to Jimmy’s app
  320. You made Jimmy’s day
  321. The IDE’s Split App template helps you build apps for navigating data
  322. Chapter 15: Events and Delegates: What your code does when you’re not looking
  323. Ever wish your objects could think for themselves?
  324. But how does an object KNOW to respond?
  325. When an EVENT occurs...objects listen
  326. One object raises its event, others listen for it...
  327. Then, the other objects handle the event
  328. Connecting the dots
  329. The IDE generates event handlers for you automatically
  330. Generic EventHandlers let you define your own event types
  331. Windows Forms use many different events
  332. One event, multiple handlers
  333. Windows Store apps use events for process lifetime management
  334. Add process lifetime management to Jimmy’s comics
  335. XAML controls use routed events
  336. Create an app to explore routed events
  337. Connecting event senders with event listeners
  338. A delegate STANDS IN for an actual method
  339. Delegates in action
  340. An object can subscribe to an event...
  341. Use a callback to control who’s listening
  342. A callback is just a way to use delegates
  343. MessageDialog uses the callback pattern
  344. Use delegates to use the Windows settings charm
  345. Chapter 16: Architecting Apps with the mvvm Pattern: Great apps on the inside and outside
  346. The Head First Basketball Conference needs an app
  347. But can they agree on how to build it?
  348. Do you design for binding or for working with data?
  349. MVVM lets you design for binding and data
  350. Use the MVVM pattern to start building the basketball roster app
  351. User controls let you create your own controls
  352. The ref needs a stopwatch
  353. MVVM means thinking about the state of the app
  354. Start building the stopwatch app’s Model
  355. Events alert the rest of the app to state changes
  356. Build the view for a simple stopwatch
  357. Add the stopwatch ViewModel
  358. Finish the stopwatch app
  359. Converters automatically convert values for binding
  360. Converters can work with many different types
  361. Styles set properties on multiple controls
  362. Use a resource dictionary to share resources between pages
  363. Visual states make controls respond to changes
  364. Use DoubleAnimation to animate double values
  365. Use object animations to animate object values
  366. Build an analog stopwatch using the same ViewModel
  367. UI controls can be instantiated with C# code, too
  368. C# can build “real” animations, too
  369. Create a user control to animate a picture
  370. Make your bees fly around a page
  371. Use ItemsPanelTemplate to bind controls to a Canvas
  372. Congratulations! (But you’re not done yet...)
  373. C# Lab Invaders
  374. Appendix Leftovers: The top 10 things we wanted to include in this book
  375. #1. There’s so much more to Windows Store
  376. #2. The Basics
  377. #3. Namespaces and assemblies
  378. #4. Use BackgroundWorker to make your WinForms responsive
  379. #5. The Type class and GetType()
  380. #6. Equality, IEquatable, and Equals()
  381. #7. Using yield return to create enumerable objects
  382. #8. Refactoring
  383. #9. Anonymous types, anonymous methods, and lambda expressions
  384. #10. LINQ to XML
  385. Did you know that C# and the .NET Framework can...
  386. Appendix Windows Presentation Foundation: WPF Learner’s Guide to Head First C#
  387. Why you should learn WPF
  388. Build WPF projects in Visual Studio
  389. How to use this appendix
  390. Chapter 1
  391. Chapter 2
  392. Chapter 10
  393. Chapter 11
  394. Chapter 12
  395. Chapter 14
  396. Chapter 15
  397. Chapter 16
书名:深入浅出C#(第3版,影印版)
国内出版社:东南大学出版社
出版时间:2014年06月
页数:1100
书号:978-7-5641-4905-5
原版书书名:Head First C#, 3rd Edition
原版书出版商:O'Reilly Media
Andrew Stellman
 
Andrew Stellman,虽然是一个土生土长的纽约人,却曾两次居住在匹兹堡。第一次是从卡耐基梅隆计算机科学学院毕业,第二次则是他和Jenny开始着手开展他们的咨询业务,并为O’Reilly写他们的第一本书。
搬回故乡后,他在大学毕业后的第一份工作是在百代唱片公司EMI-Capitol Records做一名程序员——这不无道理,因为他曾在LaGuardia音乐艺术和表演艺术学校学习大提琴和爵士乐吉它。他和Jenny的第一次共事就是在这家财务软件公司,在那里他管理着一个程序员团队,所以独享特权,可以与一些了不起的程序员共事多年,并很高兴地从他们那里学到不少东西。
平常不写书时,Andrew会忙于写一些没用(但有趣)的软件,玩音乐(不过,更多的时间是打电子游戏),学中国的太极拳和日本的合气道。他有一个女朋友Lisa,还养着一只波美拉尼亚种小狗。
Jennifer Greene and Andrew Stellman have been building software together since 1998.
Andrew comes from a programming background and has managed teams of requirements analysts, designers, and developers. Jennifer has a testing background and has managed teams of architects, developers, and testers.
She has led multiple large-scale outsourced projects.
Between the two of them, they have managed every aspect of software development. They formed Stellman & Greene Consulting in 2003, with a focus on project management, software development, management consulting, and soft-ware process improvement. They have worked in a wide range of industries, including finance, telecommunications, media,nonprofit, enter-tainment, natural language processing, science, and academia.
For more information about them and this book, visit http://www.stellman-greene.com.
 
 
Jennifer Greene
 
Jennifer Greene在大学里学的是哲学,不过,与这个领域中的所有人一样,光凭哲学没办法找到工作。幸运的是,她是一位优秀的软件测试人员,所以最早在一个网上服务公司从事这个工作,这也是她第一次切实感觉到项目管理的意义。
她于1998年移居到纽约,在一家财务软件公司做软件测试工作。她在新成立的一家很棒的公司管理着一个测试人员团队(这家公司主要研究人工智能和自然语言处理)。
在那之后,她的足迹遍布世界各地,曾与不同的软件开发团队共事,并且构建了很多相当不错的项目。
她喜欢旅游、看好莱坞电影、看漫画书。她经常把她的Xbox弄坏,等着修理。她喜欢喝很多碳酸饮料,另外还有一个机灵的小狗陪伴左右。
Jennifer Greene and Andrew Stellman have been building software together since 1998.
Andrew comes from a programming background and has managed teams of requirements analysts, designers, and developers. Jennifer has a testing background and has managed teams of architects, developers, and testers.
She has led multiple large-scale outsourced projects.
Between the two of them, they have managed every aspect of software development. They formed Stellman & Greene Consulting in 2003, with a focus on project management, software development, management consulting, and soft-ware process improvement. They have worked in a wide range of industries, including finance, telecommunications, media,nonprofit, enter-tainment, natural language processing, science, and academia.
For more information about them and this book, visit http://www.stellman-greene.com.