Microsoft Visual C# Step by Step, 8th Edition

Book description

Your hands-on guide to Microsoft Visual C# fundamentals with Visual Studio 2015
Expand your expertise--and teach yourself the fundamentals of programming with the latest version of Visual C# with Visual Studio 2015. If you are an experienced software developer, you’ll get all the guidance, exercises, and code you need to start building responsive, scalable Windows 10 and Universal Windows Platform applications with Visual C#.

Discover how to:

  • Quickly start creating Visual C# code and projects with Visual Studio 2015

  • Work with variables, operators, expressions, and methods

  • Control program flow with decision and iteration statements

  • Build more robust apps with error, exception, and resource management

  • Master the essentials of Visual C# object-oriented programming

  • Use enumerations, structures, generics, collections, indexers, and other advanced features

  • Create in-memory data queries with LINQ query expressions

  • Improve application throughput and response time with asynchronous methods

  • Decouple application logic and event handling

  • Streamline development with new app templates

  • Implement the Model-View-ViewModel (MVVM) pattern

  • Build Universal Windows Platform apps that smoothly adapt to PCs, tablets, and Windows phones

  • Integrate Microsoft Azure cloud databases and RESTful web services

  • About You

  • For software developers who are new to Visual C# or who are upgrading from older versions

  • Readers should have experience with at least one programming language

  • No prior Microsoft .NET or Visual Studio development experience required

  • Table of contents

    1. Cover
    2. Title Page
    3. Copyright Page
    4. Contents at a glance
    5. Contents
    6. Introduction
      1. Who should read this book
      2. Who should not read this book
      3. Organization of this book
        1. Finding your best starting point in this book
      4. Conventions and features in this book
      5. System requirements
      6. Code samples
        1. Installing the code samples
        2. Using the code samples
      7. Acknowledgments
      8. Errata and book support
      9. We want to hear from you
      10. Stay in touch
    7. Part I: Introducing Microsoft Visual C# and Microsoft Visual Studio 2015
      1. Chapter 1. Welcome to C#
        1. Beginning programming with the Visual Studio 2015 environment
        2. Writing your first program
        3. Using namespaces
        4. Creating a graphical application
          1. Examining the Universal Windows Platform app
          2. Adding code to the graphical application
        5. Summary
        6. Quick Reference
      2. Chapter 2. Working with variables, operators, and expressions
        1. Understanding statements
        2. Using identifiers
          1. Identifying keywords
        3. Using variables
          1. Naming variables
          2. Declaring variables
        4. Working with primitive data types
          1. Unassigned local variables
          2. Displaying primitive data type values
        5. Using arithmetic operators
          1. Operators and types
          2. Examining arithmetic operators
          3. Controlling precedence
          4. Using associativity to evaluate expressions
          5. Associativity and the assignment operator
        6. Incrementing and decrementing variables
          1. Prefix and postfix
        7. Declaring implicitly typed local variables
        8. Summary
        9. Quick Reference
      3. Chapter 3. Writing methods and applying scope
        1. Creating methods
          1. Declaring a method
          2. Returning data from a method
          3. Using expression-bodied methods
          4. Calling methods
        2. Applying scope
          1. Defining local scope
          2. Defining class scope
          3. Overloading methods
        3. Writing methods
        4. Using optional parameters and named arguments
          1. Defining optional parameters
          2. Passing named arguments
          3. Resolving ambiguities with optional parameters and named arguments
        5. Summary
        6. Quick reference
      4. Chapter 4. Using decision statements
        1. Declaring Boolean variables
        2. Using Boolean operators
          1. Understanding equality and relational operators
          2. Understanding conditional logical operators
          3. Short circuiting
          4. Summarizing operator precedence and associativity
        3. Using if statements to make decisions
          1. Understanding if statement syntax
          2. Using blocks to group statements
          3. Cascading if statements
        4. Using switch statements
          1. Understanding switch statement syntax
          2. Following the switch statement rules
        5. Summary
        6. Quick reference
      5. Chapter 5. Using compound assignment and iteration statements
        1. Using compound assignment operators
        2. Writing while statements
        3. Writing for statements
          1. Understanding for statement scope
        4. Writing do statements
        5. Summary
        6. Quick reference
      6. Chapter 6. Managing errors and exceptions
        1. Coping with errors
        2. Trying code and catching exceptions
          1. Unhandled exceptions
          2. Using multiple catch handlers
          3. Catching multiple exceptions
          4. Propagating exceptions
        3. Using checked and unchecked integer arithmetic
          1. Writing checked statements
          2. Writing checked expressions
        4. Throwing exceptions
        5. Using a finally block
        6. Summary
        7. Quick reference
    8. Part II: Understanding the C# object model
      1. Chapter 7. Creating and managing classes and objects
        1. Understanding classification
        2. The purpose of encapsulation
        3. Defining and using a class
        4. Controlling accessibility
          1. Working with constructors
          2. Overloading constructors
        5. Understanding static methods and data
          1. Creating a shared field
          2. Creating a static field by using the const keyword
          3. Understanding static classes
          4. Static using statements
          5. Anonymous classes
        6. Summary
        7. Quick reference
      2. Chapter 8. Understanding values and references
        1. Copying value type variables and classes
        2. Understanding null values and nullable types
          1. Using nullable types
          2. Understanding the properties of nullable types
        3. Using ref and out parameters
          1. Creating ref parameters
          2. Creating out parameters
        4. How computer memory is organized
          1. Using the stack and the heap
        5. The System.Object class
        6. Boxing
        7. Unboxing
        8. Casting data safely
          1. The is operator
          2. The as operator
        9. Summary
        10. Quick reference
      3. Chapter 9. Creating value types with enumerations and structures
        1. Working with enumerations
          1. Declaring an enumeration
          2. Using an enumeration
          3. Choosing enumeration literal values
          4. Choosing an enumeration’s underlying type
        2. Working with structures
          1. Declaring a structure
          2. Understanding differences between structures and classes
          3. Declaring structure variables
          4. Understanding structure initialization
          5. Copying structure variables
        3. Summary
        4. Quick reference
      4. Chapter 10. Using arrays
        1. Declaring and creating an array
          1. Declaring array variables
          2. Creating an array instance
        2. Populating and using an array
          1. Creating an implicitly typed array
          2. Accessing an individual array element
          3. Iterating through an array
          4. Passing arrays as parameters and return values for a method
        3. Copying arrays
        4. Using multidimensional arrays
          1. Creating jagged arrays
        5. Summary
        6. Quick reference
      5. Chapter 11. Understanding parameter arrays
        1. Overloading—a recap
        2. Using array arguments
          1. Declaring a params array
          2. Using params object[]
          3. Using a params array
        3. Comparing parameter arrays and optional parameters
        4. Summary
        5. Quick reference
      6. Chapter 12. Working with inheritance
        1. What is inheritance?
        2. Using inheritance
          1. The System.Object class revisited
          2. Calling base-class constructors
          3. Assigning classes
          4. Declaring new methods
          5. Declaring virtual methods
          6. Declaring override methods
          7. Understanding protected access
        3. Understanding extension methods
        4. Summary
        5. Quick reference
      7. Chapter 13. Creating interfaces and defining abstract classes
        1. Understanding interfaces
          1. Defining an interface
          2. Implementing an interface
          3. Referencing a class through its interface
          4. Working with multiple interfaces
          5. Explicitly implementing an interface
          6. Interface restrictions
          7. Defining and using interfaces
        2. Abstract classes
          1. Abstract methods
        3. Sealed classes
          1. Sealed methods
          2. Implementing and using an abstract class
        4. Summary
        5. Quick reference
      8. Chapter 14. Using garbage collection and resource management
        1. The life and times of an object
          1. Writing destructors
          2. Why use the garbage collector?
          3. How does the garbage collector work?
          4. Recommendations
        2. Resource management
          1. Disposal methods
          2. Exception-safe disposal
          3. The using statement and the IDisposable interface
          4. Calling the Dispose method from a destructor
        3. Implementing exception-safe disposal
        4. Summary
        5. Quick reference
    9. Part III: Defining extensible types with C#
      1. Chapter 15. Implementing properties to access fields
        1. Implementing encapsulation by using methods
        2. What are properties?
          1. Using properties
          2. Read-only properties
          3. Write-only properties
          4. Property accessibility
        3. Understanding the property restrictions
        4. Declaring interface properties
          1. Replacing methods with properties
        5. Generating automatic properties
        6. Initializing objects by using properties
        7. Summary
        8. Quick reference
      2. Chapter 16. Using indexers
        1. What is an indexer?
          1. An example that doesn’t use indexers
          2. The same example using indexers
          3. Understanding indexer accessors
          4. Comparing indexers and arrays
        2. Indexers in interfaces
        3. Using indexers in a Windows application
        4. Summary
        5. Quick reference
      3. Chapter 17. Introducing generics
        1. The problem with the object type
        2. The generics solution
          1. Generics vs. generalized classes
          2. Generics and constraints
        3. Creating a generic class
          1. The theory of binary trees
          2. Building a binary tree class by using generics
        4. Creating a generic method
          1. Defining a generic method to build a binary tree
        5. Variance and generic interfaces
          1. Covariant interfaces
          2. Contravariant interfaces
        6. Summary
        7. Quick reference
      4. Chapter 18. Using collections
        1. What are collection classes?
          1. The List<T> collection class
          2. The LinkedList<T> collection class
          3. The Queue<T> collection class
          4. The Stack<T> collection class
          5. The Dictionary<TKey, TValue> collection class
          6. The SortedList<TKey, TValue> collection class
          7. The HashSet<T> collection class
        2. Using collection initializers
        3. The Find methods, predicates, and lambda expressions
          1. The forms of lambda expressions
        4. Comparing arrays and collections
          1. Using collection classes to play cards
        5. Summary
        6. Quick reference
      5. Chapter 19. Enumerating collections
        1. Enumerating the elements in a collection
          1. Manually implementing an enumerator
          2. Implementing the IEnumerable interface
        2. Implementing an enumerator by using an iterator
          1. A simple iterator
          2. Defining an enumerator for the Tree<TItem> class by using an iterator
        3. Summary
        4. Quick reference
      6. Chapter 20. Decoupling application logic and handling events
        1. Understanding delegates
          1. Examples of delegates in the .NET Framework class library
          2. The automated factory scenario
          3. Implementing the factory control system without using delegates
          4. Implementing the factory by using a delegate
          5. Declaring and using delegates
        2. Lambda expressions and delegates
          1. Creating a method adapter
        3. Enabling notifications by using events
          1. Declaring an event
          2. Subscribing to an event
          3. Unsubscribing from an event
          4. Raising an event
        4. Understanding user interface events
          1. Using events
        5. Summary
        6. Quick reference
      7. Chapter 21. Querying in-memory data by using query expressions
        1. What is LINQ?
        2. Using LINQ in a C# application
          1. Selecting data
          2. Filtering data
          3. Ordering, grouping, and aggregating data
          4. Joining data
          5. Using query operators
          6. Querying data in Tree<TItem> objects
          7. LINQ and deferred evaluation
        3. Summary
        4. Quick reference
      8. Chapter 22. Operator overloading
        1. Understanding operators
          1. Operator constraints
          2. Overloaded operators
          3. Creating symmetric operators
        2. Understanding compound assignment evaluation
        3. Declaring increment and decrement operators
        4. Comparing operators in structures and classes
        5. Defining operator pairs
        6. Implementing operators
        7. Understanding conversion operators
          1. Providing built-in conversions
          2. Implementing user-defined conversion operators
          3. Creating symmetric operators, revisited
          4. Writing conversion operators
        8. Summary
        9. Quick reference
    10. Part IV: Building Universal Windows Platform applications with C#
      1. Chapter 23. Improving throughput by using tasks
        1. Why perform multitasking by using parallel processing?
          1. The rise of the multicore processor
        2. Implementing multitasking by using the Microsoft .NET Framework
          1. Tasks, threads, and the ThreadPool
          2. Creating, running, and controlling tasks
          3. Using the Task class to implement parallelism
          4. Abstracting tasks by using the Parallel class
          5. When not to use the Parallel class
        3. Canceling tasks and handling exceptions
          1. The mechanics of cooperative cancellation
          2. Using continuations with canceled and faulted tasks
        4. Summary
        5. Quick reference
      2. Chapter 24. Improving response time by performing asynchronous operations
        1. Implementing asynchronous methods
          1. Defining asynchronous methods: The problem
          2. Defining asynchronous methods: The solution
          3. Defining asynchronous methods that return values
          4. Asynchronous method gotchas
          5. Asynchronous methods and the Windows Runtime APIs
        2. Using PLINQ to parallelize declarative data access
          1. Using PLINQ to improve performance while iterating through a collection
          2. Canceling a PLINQ query
        3. Synchronizing concurrent access to data
          1. Locking data
          2. Synchronization primitives for coordinating tasks
          3. Canceling synchronization
          4. The concurrent collection classes
          5. Using a concurrent collection and a lock to implement thread-safe data access
        4. Summary
        5. Quick reference
      3. Chapter 25. Implementing the user interface for a Universal Windows Platform app
        1. Features of a Universal Windows Platform app
        2. Using the Blank App template to build a Universal Windows Platform app
          1. Implementing a scalable user interface
          2. Applying styles to a UI
        3. Summary
        4. Quick reference
      4. Chapter 26. Displaying and searching for data in a Universal Windows Platform app
        1. Implementing the Model-View-ViewModel pattern
          1. Displaying data by using data binding
          2. Modifying data by using data binding
          3. Using data binding with a ComboBox control
          4. Creating a ViewModel
          5. Adding commands to a ViewModel
        2. Searching for data using Cortana
          1. Providing a vocal response to voice commands
        3. Summary
        4. Quick reference
      5. Chapter 27. Accessing a remote database from a Universal Windows Platform app
        1. Retrieving data from a database
          1. Creating an entity model
          2. Creating and using a REST web service
        2. Inserting, updating, and deleting data through a REST web service
          1. Reporting errors and updating the UI
        3. Summary
        4. Quick reference
    11. Index
    12. About the author
    13. Visit us today at microsoftpressstore.com
    14. Wait, there’s more...
    15. Free ebooks
    16. Survey
    17. Code Snippets

    Product information

    • Title: Microsoft Visual C# Step by Step, 8th Edition
    • Author(s): John Sharp
    • Release date: November 2015
    • Publisher(s): Microsoft Press
    • ISBN: 9781509301072