You are previewing Start Here!™: Learn Microsoft® Visual C#® 2010.
O'Reilly logo
Start Here!™: Learn Microsoft® Visual C#® 2010

Book Description

Ready to learn programming? Start Here!

Learn the fundamentals of modern programming with Visual C# 2010—and begin building your first apps for the desktop and web. If you have absolutely no previous experience, no problem—simply start here! This book introduces must-know concepts and techniques through easy-to-follow explanations, examples, and exercises.

Here’s where you start learning Visual C#

  • Learn how an application performs tasks by tracing its code

  • Query and manipulate application data with LINQ

  • Access web services with REST and SOAP

  • Build simple apps with Windows Presentation Foundation

  • Explore rich Internet apps with Microsoft Silverlight

  • Find and fix errors by debugging your applications

  • Put it all together by creating your first programs

  • Table of Contents

    1. Start Here!™: Learn Microsoft® Visual C#® 2010
    2. Dedication
    3. A Note Regarding Supplemental Files
    4. Introduction
      1. Who Should Read This Book
        1. Assumptions
      2. Who Should Not Read This Book
      3. Organization of This Book
      4. Free eBook Reference
      5. Conventions and Features in This Book
      6. System Requirements
      7. Code Samples
        1. Installing the Code Samples
        2. Using the Code Samples
      8. Acknowledgments
      9. Errata & Book Support
      10. We Want to Hear from You
      11. Stay in Touch
    5. 1. Getting to Know C#
      1. Obtaining and Installing Visual Studio 2010 Express
        1. Downloading the Products
        2. Installing Visual C# 2010 Express
        3. Installing Visual Web Developer 2010 Express
        4. Installing Visual Studio 2010 Service Pack 1
      2. Starting Visual C# 2010 Express
      3. Creating the No-Code Web Browser
        1. Creating a New Windows Forms Application Project
        2. Saving Your Project
        3. Adding Windows Forms Controls
        4. Configuring the Windows Forms Controls
        5. Testing the Windows Forms Application
        6. Viewing the Web Browser Code
        7. Ending Your Session
      4. Creating the No-Code WPF Web Browser
        1. Starting a New WPF Application Project
        2. Adding WPF Controls
        3. Configuring the WPF Controls
        4. Trying the WPF Application
        5. Viewing the WPF Code
      5. Creating the No Code WPF Browser Application
        1. Setting Internet Explorer as the Default
        2. Starting a WPF Browser Application Project
        3. Creating the WPF Browser Application
        4. Adding WPF Browser Controls
        5. Configuring the WPF Browser Controls
        6. Trying the WPF Browser Application
        7. Viewing the WPF Browser Code
      6. Get Going with C#
    6. 2. Developing a Web Project
      1. Starting Visual Web Developer 2010 Express
      2. Creating the No-Code Project
        1. Starting the New Project
        2. Understanding the Default Site
          1. Looking at the Elements
          2. Working with the Master Page
          3. Changing the Default.aspx Content
          4. Viewing the Master.Site File Code
        3. Viewing the Site in a Browser
      3. Creating the No Code Website
        1. Defining a Website Location
        2. Adding a New Page
        3. Adding the Page to the Site Menu
        4. Trying the Site in a Browser
      4. Get Going with C#
    7. 3. Basic Data Manipulation Techniques
      1. Understanding LINQ
      2. Creating the List Project
        1. Starting the List Project
        2. Adding the Controls
        3. Configuring the Controls
      3. Using the Code Editor
        1. Using the Double-Click Method
        2. Choosing an Event Directly
        3. Using the Right-Click Method
        4. Understanding the Code Editor Features
        5. Writing Some Simple Code
      4. Testing the List Application
      5. Tracing the List Application with the Debugger
        1. Discovering Application Functionality Through Tracing
        2. Creating a Breakpoint
        3. Viewing Application Data
        4. Testing a Theory
          1. Changing the TextBox Data
          2. Selecting Other Elements
      6. Creating the List 2 Project
        1. Starting the Second List Project
        2. Copying the Controls
        3. Finessing the Controls
        4. Adding the Extended Code
        5. Tracing Through the Extended Example
        6. Understanding Data Types
          1. Changing the Code to Match the Data Type
          2. Mixing Data Types in the Text Box
        7. Testing Selection Theories
          1. Skipping TextBox Elements
          2. Selecting Specific TextBox Elements
      7. Get Going with C#
    8. 4. Using Collections to Store Data
      1. Understanding Arrays
      2. Creating the Array Project
        1. Starting the Array Project
        2. Adding the Array Project Controls
        3. Configuring the Array Project Controls
        4. Adding the Array Code
        5. Tracing Through the Array Example
        6. Testing Looping Theories
        7. Testing Conditional Theories
      3. Understanding Dictionaries
      4. Creating the Dictionary Project
        1. Starting the Dictionary Project
        2. Adding the Dictionary Project Controls
        3. Configuring the Dictionary Project Controls
        4. Adding the Dictionary Code
        5. Tracing Through the Dictionary Example
        6. Testing Sorting Theories
        7. Testing Statistical Theories
      5. Understanding Structures
      6. Creating the Structure Project
        1. Starting the Structure Project
        2. Adding the Structure Project Controls
        3. Configuring the Structure Project Controls
        4. Creating a Structure
        5. Adding the Structure Example Code
        6. Tracing Through the Structure Example
      7. Get Going with C#
    9. 5. Working with XML
      1. Understanding XML
      2. Combining XML and LINQ
        1. Defining the XML_LINQ Project
        2. Adding and Configuring the XML_LINQ Controls
        3. Using the System.Xml.Linq Namespace
        4. Adding the XML_LINQ Code
      3. Developing the XMLSave Application
        1. Creating the XMLSave Project
          1. Adding and Configuring the XMLSave Controls
        2. Adding XMLSave Application Code
        3. Testing the XMLSave Application
        4. Viewing the XMLSave Output
      4. Developing the XMLRead Application
        1. Creating the XMLRead Project
          1. Adding and Configuring the XMLRead Controls
        2. Adding the XMLRead Application Code
        3. Testing the XMLRead Application
        4. Tracing the XMLRead Application with the Debugger
        5. Handling XML Exceptions
      5. Using XML to Store Application Settings
        1. Creating the XMLSetting Project
          1. Adding and Configuring the XMLSetting Controls
        2. Adding the XMLSetting Application Code
          1. Saving the Settings
          2. Restoring the Settings
          3. Defining the Using Statements
        3. Testing the XMLSetting Application
      6. Get Going with C#
    10. 6. Accessing a Web Service
      1. Defining Web Services
      2. Web Services and XML
      3. Working with REST Web Services
      4. Working with SOAP Web Services
      5. Developing the REST Web Service Application
        1. Creating the RESTService Project
          1. Adding and Configuring the RESTService Controls
        2. Adding the RESTService Application Code
          1. Creating the Global Variables
          2. Getting a Forecast
          3. Displaying the Data
          4. Initializing the Application
          5. Selecting the Next and Previous Forecasts
          6. Entering a New Location
          7. Choosing a Different Icon
        3. Testing the RESTService Application
      6. Developing the SOAP Web Service Application
        1. Creating the SOAPService Project
        2. Adding and Configuring the SOAPService Controls
        3. Adding the SOAPService Application Code
        4. Testing the SOAPService Application
      7. Get Going with C#
    11. 7. Using the Windows Presentation Foundation
      1. Considering the WPF Differences with Windows Forms Applications
      2. Understanding XAML
      3. Developing the WPF Data Store Application
        1. Creating the WPF_XML Project
        2. Adding and Configuring the WPF_XML Controls
        3. Adding the WPF_XML Application Code
          1. Defining the Using Statements
          2. Ending the Application
          3. Saving the Settings
          4. Restoring the Settings
        4. Testing the WPF_XML Application
        5. Tracing the WPF_XML Application with the Debugger
      4. Developing the WPF SOAP Web Service Application
        1. Creating the WPFSOAPService Project
        2. Adding a New Service Data Source
        3. Adding and Configuring the WPFSOAPService Controls
        4. Adding the WPFSOAPService Application Code
        5. Testing the WPFSOAPService Application
      5. Developing the EmbeddedSource Application
        1. Starting the EmbeddedSource Project
        2. Creating an Embedded Resource
        3. Adding and Configuring the EmbeddedSource Controls
        4. Adding the EmbeddedSource Application Code
          1. Adding the Required using Statements
          2. Performing the Application Setup
          3. Moving Between Items
        5. Testing the EmbeddedSource Application
        6. Tracing the EmbeddedSource Application with the Debugger
      6. Get Going with C#
    12. 8. Working with Libraries
      1. Understanding Reusable Code
      2. Considering How Classes Work
        1. Defining Methods
        2. Defining Properties
        3. Understanding Fields versus Properties
        4. Defining Events
        5. Using Enumerations
        6. Understanding Structures
      3. Creating the UseLibrary Solution
        1. Starting the TestLibrary Project
        2. Adding the TestLibrary Code
          1. Creating a Constructor
          2. Defining an Enumeration
          3. Creating the Private Variables and Public Properties
          4. Defining a Structure
          5. Describing Events
          6. Developing Methods
      4. Adding the TestApplication Project
        1. Starting the TestApplication Project
        2. Setting TestApplication as the Startup Project
        3. Defining the TestLibrary Reference
        4. Adding and Configuring the TestApplication Controls
        5. Adding the TestApplication Application Code
          1. Adding the Required Using Statements
          2. Configuring the Application
          3. Displaying the Ball Data
          4. Adding and Removing Balls
          5. Moving Between Balls
          6. Displaying a List of Balls
          7. Handling Class Events
      5. Testing the UseLibrary Application
      6. Get Going with C#
    13. 9. Creating Utility Applications
      1. Working at the Command Line
        1. Opening and Using the Command Line
        2. Understanding Utility Application Uses
      2. Creating the Console Application
      3. Defining Command-Line Parameters
        1. Creating the Main() Method
        2. Offering Help at the Command Line
        3. Checking for Required Arguments
        4. Checking for Optional Arguments
      4. Testing the DisplayDate Application
        1. Opening the Command Line
        2. Checking the Help Functionality
        3. Displaying a Date
      5. Tracing the DisplayDate Application with the Debugger
        1. Setting the Command-Line Arguments
        2. Performing the Trace
      6. Get Going with C#
    14. 10. Using LINQ in Web Applications
      1. Creating the WebList Project
        1. Starting the WebList Project
        2. Adding and Configuring the WebList Project Controls
        3. Defining the using Statement
        4. Adding the WebList Project Code
        5. Tracing Through the WebList Project Example
      2. Creating the WebArray Project
        1. Starting the WebArray Project
        2. Adding and Configuring the WebArray Project Controls
        3. Adding the WebArray Code
          1. Creating the Array
          2. Developing the LINQ Version
          3. Developing the Loop Version
          4. Developing the Conditional Loop Version
        4. Tracing Through the WebArray Example
      3. Creating the WebStructure Project
        1. Starting the WebStructure Project
        2. Adding and Configuring the WebStructure Project Controls
        3. Adding the WebStructure Code
          1. Defining the Data Structure
          2. Loading the Page
          3. Showing an Entry
          4. Moving Between Records
        4. Tracing Through the Structure Example
      4. Get Going with C#
    15. 11. Working with Silverlight Applications
      1. Understanding the Silverlight Development Difference
      2. Developing a Basic Silverlight Application
        1. Starting the BasicSilverlight Application
        2. Adding and Configuring the BasicSilverlight Project Controls
        3. Adding the BasicSilverlight Project Code
          1. Adding the Required Using Statement
          2. Initializing the Global Variable
          3. Enabling the Buttons After an Image Loads
          4. Handling Radio Button Clicks
        4. Tracing Through the BasicSilverlight Project Example
      3. Configuring Your Silverlight Application for Debugging
        1. Setting the Browser Configuration
        2. Debugging with Firefox
      4. Adding XML Data Support to a Silverlight Application
        1. Starting the SilverlightXML Application
        2. Adding and Configuring the SilverlightXML Project Controls
        3. Adding the SilverlightXML Project Code
          1. Adding the Required References and Using Statements
          2. Creating the Global Variables
          3. Saving the Settings
          4. Restoring the Settings
        4. Tracing Through the SilverlightXML Project Example
      5. Get Going with C#
    16. 12. Debugging Applications
      1. Understanding the Debugging Basics
      2. Stepping Through the Code
        1. Working with the Debug Class
        2. Adding Debug Statements to the Example
        3. Working with the Trace Class
      3. Working with Watches
      4. Using Visualizers
      5. Drilling Down into Data
      6. Understanding the Call Stack
      7. Using the Immediate Window
      8. Working with Exceptions
        1. Understanding an Exception Dialog Box
        2. Communicating with the Administrator Using the Event Log
      9. Get Going with C#
    17. Index
    18. About the Author
    19. Copyright