Books & Videos

Table of Contents

  1. Chapter 1 Get Productive With c#: Visual Applications, in 10 minutes or less

    1. 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. Here’s what you’re going to build

    6. What you do in Visual Studio...

    7. What Visual Studio does for you...

    8. Develop the user interface

    9. Visual Studio, behind the scenes

    10. Add to the auto-generated code

    11. You can already run your application

    12. Where are my files?

    13. Here’s what we’ve done so far

    14. We need a database to store our information

    15. The IDE created a database

    16. SQL is its own language

    17. Creating the table for the Contact List

    18. The blanks on contact card are columns in our People table

    19. Finish building the table

    20. Diagram your data

    21. Insert your card data into the database

    22. Connect your form to your database objects with a data source

    23. Add database-driven controls to your form

    24. Good programs are intuitive to use

    25. Test drive

    26. How to turn YOUR application into EVERYONE’S application

    27. Give your users the application

    28. You built a complete data-driven application

    29. You built a complete data-driven application

    30. CSharpcross

    31. CSharpcross Solution

  2. Chapter 2 It’s All Just Code: Under the Hood

    1. When you’re doing this...

    2. ...the IDE does this

    3. Where programs come from

    4. The IDE helps you code

    5. When you change things in the IDE, you’re also changing your code

    6. Anatomy of a program

    7. Your program knows where to start

    8. You can change your program’s entry point

    9. Two classes can be in the same namespace

    10. Your programs use variables to work with data

    11. C# uses familiar math symbols

    12. Loops perform an action over and over again

    13. Time to start coding

    14. if/else statements make decisions

    15. Set up conditions and see if they’re true

    16. Csharpcross

    17. Csharpcross Solution

  3. Chapter 3 Objects: Get Oriented!: Making Code Make Sense

    1. How Mike thinks about his problems

    2. How Mike’s car navigation system thinks about his problems

    3. Mike’s Navigator class has methods to set and modify routes

    4. Use what you’ve learned to build a simple application

    5. Mike gets an idea

    6. Mike can use objects to solve his problem

    7. You use a class to build an object

    8. When you create a new object from a class, it’s called an instance of that class.

    9. A better solution... brought to you by objects!

    10. An instance uses fields to keep track of things

    11. Let’s create some instances!

    12. Thanks for the memory

    13. What’s on your program’s mind

    14. You can use class and method names to make your code intuitive

    15. Give your classes a natural structure

    16. Class diagrams help you organize your classes so they make sense

    17. Build a class to work with some guys

    18. Create a project for your guys

    19. Build a form to interact with the guys

    20. There’s an even easier way to initialize objects

    21. A few ideas for designing intuitive classes

    22. Objectcross

    23. Objectcross Solution

  4. Chapter 4 Types and References: It’s 10:00. Do you know where your data is?

    1. The variable’s type determines what kind of data it can store

    2. A variable is like a data to-go cup

    3. 10 pounds of data in a 5 pound bag

    4. Even when a number is the right size, you can’t just assign it to any variable

    5. When you cast a value that’s too big, C# will adjust it automatically

    6. C# does some casting automatically

    7. When you call a method, the variables must match the types of the parameters

    8. Combining = with an operator

    9. Objects use variables, too

    10. Refer to your objects with reference variables

    11. References are like labels for your object

    12. If there aren’t any more references, your object gets garbage collected

    13. Typecross

    14. Multiple references and their side effects

    15. Two references means TWO ways to change an object’s data

    16. A special case: arrays

    17. Arrays can contain a bunch of reference variables, too

    18. Welcome to Sloppy Joe’s Budget House o’ Discount Sandwiches!

    19. Objects use references to talk to each other

    20. Where no object has gone before

    21. Typecross Solution

  5. C# Lab A Day at the Races

    1. Chapter 5 Encapsulation: Keep your privates... private

      1. Kathleen is an event planner
      2. What does the estimator do?
      3. Kathleen’s Test Drive
      4. Each option should be calculated individually
      5. It’s easy to accidentally misuse your objects
      6. Encapsulation means keeping some of the data in a class private
      7. Use encapsulation to control access to your class’s methods and fields
      8. But is the realName field REALLY protected?
      9. Private fields and methods can only be accessed from inside the class
      10. A few ideas for encapsulating classes
      11. Encapsulation keeps your data pristine
      12. Properties make encapsulation easier
      13. Build an application to test the Farmer class
      14. Use automatic properties to finish the class
      15. What if we want to change the feed multiplier?
      16. Use a constructor to initialize private fields
    2. Chapter 6 Inheritance: Your object’s family tree

      1. Kathleen does birthday parties, too
      2. We need a BirthdayParty class
      3. One more thing... can you add a $100 fee for parties over 12?
      4. When your classes use inheritance, you only need to write your code once
      5. Build up your class model by starting general and getting more specific
      6. How would you design a zoo simulator?
      7. Use inheritance to avoid duplicate code in subclasses
      8. Different animals make different noises
      9. Think about how to group the animals
      10. Create the class hierarchy
      11. Every subclass extends its base class
      12. Use a colon to inherit from a base class
      13. We know that inheritance adds the base class fields, properties, and methods to the subclass...
      14. A subclass can override methods to change or replace methods it inherited
      15. Any place where you can use a base class, you can use one of its subclasses instead
      16. A subclass can access its base class using the base keyword
      17. When a base class has a constructor, your subclass needs one too
      18. Now you’re ready to finish the job for Kathleen!
      19. Build a beehive management system
      20. First you’ll build the basic system
      21. Use inheritance to extend the bee management system
    3. Chapter 7 Interfaces and Abstract Classes: Making classes keep their promises

      1. Let’s get back to bee-sics
      2. We can use inheritance to create classes for different types of bees
      3. An interface tells a class that it must implement certain methods and properties
      4. Use the interface keyword to define an interface
      5. Now you can create an instance of NectarStinger that does both jobs
      6. Classes that implement interfaces have to include ALL of the interface’s methods
      7. Get a little practice using interfaces
      8. You can’t instantiate an interface, but you can reference an interface
      9. Interface references work just like object references
      10. You can find out if a class implements a certain interface with “is”
      11. Interfaces can inherit from other interfaces
      12. The RoboBee 4000 can do a worker bee’s job without using valuable honey
      13. is tells you what an object implements, as tells the compiler how to treat your object
      14. A CoffeeMaker is also an Appliance
      15. Upcasting works with both objects and interfaces
      16. Downcasting lets you turn your appliance back into a coffee maker
      17. Upcasting and downcasting work with interfaces, too
      18. There’s more than just public and private
      19. Access modifiers change scope
      20. Some classes should never be instantiated
      21. An abstract class is like a cross between a class and an interface
      22. Like we said, some classes should never be instantiated
      23. An abstract method doesn’t have a body
      24. Polymorphism means that one object can take many different forms
    4. Chapter 8 Enums and Collections: Storing lots of data

      1. Strings don’t always work for storing categories of data
      2. Enums let you enumerate a set of valid values
      3. Enums let you represent numbers with names
      4. We could use an array to create a deck of cards...
      5. Arrays are hard to work with
      6. Lists make it easy to store collections of... anything
      7. Lists are more flexible than arrays
      8. Lists shrink and grow dynamically
      9. List objects can store any type
      10. Collection initializers work just like object initializers
      11. Let’s create a list of Ducks
      12. Lists are easy, but SORTING can be tricky
      13. Two ways to sort your ducks
      14. Use IComparer to tell your List how to sort
      15. Create an instance of your comparer object
      16. IComparer can do complex comparisons
      17. Use a dictionary to store keys and values
      18. The Dictionary Functionality Rundown
      19. Your key and value can be different types, too
      20. You can build your own overloaded methods
      21. And yet MORE collection types...
      22. A queue is FIFO — First In, First Out
      23. A stack is LIFO — Last In, First Out
  6. C# Lab: The Quest

    1. Chapter 9 Reading and Writing Files: Save the byte array, save the world

      1. C# uses streams to read and write data
      2. Different streams read and write different things
      3. A FileStream writes bytes to a file
      4. How to write text to a file in 3 simple steps
      5. The Swindler launches another diabolical plan
      6. Reading and writing takes two objects
      7. Data can go through more than one stream
      8. Use built-in objects to pop up standard dialog boxes
      9. Dialog boxes are just another .NET control
      10. Dialog boxes are objects, too
      11. Use the built-in File and Directory classes to work with files and directories
      12. Use File Dialogs to open and save files (all with just a few lines of code)
      13. IDisposable makes sure your objects are disposed properly
      14. Avoid file system errors with using statements
      15. Trouble at work
      16. Writing files usually involves making a lot of decisions
      17. Use a switch statement to choose the right option
      18. Use a switch statement to let your deck of cards read from a file or write itself out to one
      19. Add an overloaded Deck() constructor that reads a deck of cards in from a file
      20. What happens to an object when it’s serialized?
      21. But what exactly IS an object’s state? What needs to be saved?
      22. When an object is serialized, all of the objects it refers to get serialized too...
      23. Serialization lets you read or write a whole object all at once
      24. If you want your class to be serializable, mark it with the [Serializable] attribute
      25. Let’s serialize and deserialize a deck of cards
      26. .NET converts text to Unicode automatically
      27. C# can use byte arrays to move data around
      28. Use a BinaryWriter to write binary data
      29. You can read and write serialized files manually, too
      30. Find where the files differ, and use that information to alter them
      31. Working with binary files can be tricky
      32. Use file streams to build a hex dumper
      33. StreamReader and StreamWriter will do just fine
    2. Chapter 10 Exception Handling: Putting out fires gets old

      1. Brian needs his excuses to be mobile
      2. When your program throws an exception, .NET generates an Exception object.
      3. Brian’s code did something unexpected
      4. All exception objects inherit from Exception
      5. The debugger helps you track down and prevent exceptions in your code
      6. Use the IDE’s debugger to ferret out exactly what went wrong in the excuse manager
      7. Uh-oh—the code’s still got problems...
      8. Handle exceptions with try and catch
      9. What happens when a method you want to call is risky?
      10. Use the debugger to follow the try/catch flow
      11. If you have code that ALWAYS should run, use a finally block
      12. Use the Exception object to get information about the problem
      13. Use more than one catch block to handle multiple types of exceptions
      14. One class throws an exception, another class catches the exception
      15. Bees need an OutOfHoney exception
      16. An easy way to avoid a lot of problems: using gives you try and finally for free
      17. Exception avoidance: implement IDisposable to do your own clean up
      18. The worst catch block EVER: comments
      19. Temporary solutions are okay (temporarily)
      20. A few simple ideas for exception handling
      21. Brian finally gets his vacation...
    3. Chapter 11 Events and Delegates: What your code does when you’re not looking

      1. Ever wish your objects could think for themselves?
      2. But how does an object KNOW to respond?
      3. When an EVENT occurs... objects listen
      4. One object raises its event, others listen for it...
      5. Then, the other objects handle the event
      6. Connecting the dots
      7. The IDE creates event handlers for you automatically
      8. The forms you’ve been building all use events
      9. Connecting event senders with event receivers
      10. A delegate STANDS IN for an actual method
      11. Delegates in action
      12. Any object can subscribe to a public event...
      13. Use a callback instead of an event to hook up exactly one object to a delegate
      14. Callbacks use delegates, but NOT events
    4. Chapter 12 Review and Preview: Knowledge, power, and building cool stuff

      1. You’ve come a long way, baby
      2. We’ve also become beekeepers
      3. The beehive simulator architecture
      4. Building the beehive simulator
      5. Life and death of a flower
      6. Now we need a Bee class
      7. P. A. H. B. (Programmers Against Homeless Bees)
      8. The hive runs on honey
      9. Filling out the Hive class
      10. The hive’s Go() method
      11. We’re ready for the World
      12. We’re building a turn-based system
      13. Here’s the code for World
      14. Giving the bees behavior
      15. The main form tells the world to Go()
      16. We can use World to get statistics
      17. Timers fire events over and over again
      18. The timer’s using a delegate behind the scenes
      19. Add a Timer to the simulator
      20. Test drive
      21. Let’s work with groups of bees
      22. A collection collects... DATA
      23. LINQ makes working with data in collections and databases easy
      24. Test drive (Part 2)
      25. One final challenge: Open and Save
    5. Chapter 13 Controls and Graphics: Make it pretty

      1. You’ve been using controls all along to interact with your programs
      2. Form controls are just objects
      3. Use controls to animate the beehive simulator
      4. Add a renderer to your architecture
      5. The renderer draws everything in the World on the two forms
      6. Controls are well-suited for visual display elements
      7. Build your first animated control
      8. BeeControl is LIKE a PictureBox... so let’s start by INHERITING from PictureBox
      9. Create a button to add the BeeControl to your form
      10. Your controls need to dispose their controls, too!
      11. A UserControl is an easy way to build a control
      12. The renderer uses your BeeControl to draw animated bees on your forms
      13. Add the hive and field forms to the project
      14. Build the Renderer
      15. Now connect the main form to your two new forms, HiveForm and FieldForm
      16. Test drive... ahem... buzz
      17. Looks great, but something’s not quite right...
      18. Let’s take a closer look at those performance issues
      19. You resized your Bitmaps using a Graphics object
      20. Your image resources are stored in Bitmap objects
      21. Use System.Drawing to TAKE CONTROL of graphics yourself
      22. A 30-second tour of GDI+ graphics
      23. Use graphics to draw a picture on a form
      24. Graphics can fix our transparency problem...
      25. Use the Paint event to make your graphics stick
      26. A closer look at how forms and controls repaint themselves
      27. Double buffering makes animation look a lot smoother
      28. Double buffering is built into forms and controls
      29. Use a Graphics object and an event handler for printing
      30. PrintDocument works with the print dialog and print preview window objects
      31. There’s so much more to be done...
    6. Chapter 14 Captain Amazing the Death of the Object

      1. Your last chance to DO something... your object’s finalizer
      2. When EXACTLY does a finalizer run?
      3. Dispose() works with using, finalizers work with garbage collection
      4. Finalizers can’t depend on stability
      5. Make an object serialize itself in its Dispose()
      6. A struct looks like an object...
      7. ..but isn’t on the heap
      8. Values get copied, references get assigned
      9. Structs are value types; objects are reference types
      10. The stack vs. the heap: more on memory
      11. Captain Amazing... not so much
      12. Extension methods add new behavior to EXISTING classes
      13. Extending a fundamental type: string
    7. Chapter 15 Linq: Get control of your data

      1. An easy project...
      2. ... but the data’s all over the place
      3. LINQ can pull data from multiple sources
      4. .NET collections are already set up for LINQ
      5. LINQ makes queries easy
      6. LINQ is simple, but your queries don’t have to be
      7. LINQ is versatile
      8. LINQ can combine your results into groups
      9. Combine Jimmy’s values into groups
      10. Use join to combine two collections into one query
      11. Jimmy saved a bunch of dough
      12. Connect LINQ to a SQL database
      13. Use a join query to connect Starbuzz and Objectville
  7. C# Lab 3: Invaders

    1. Appendix Leftovers: The top 5 things we wanted to include in this book

      1. #1 LINQ to XML
      2. #2 Refactoring
      3. #3 Some of our favorite Toolbox components
      4. #4 Console Applications
      5. #5 Windows Presentation Foundation
      6. Did you know that C# and the .NET Framework can...