A logical, straightforward approach to learning the C# language C# is a complicated programming language for building .NET-connected software for Microsoft Windows, the Web, and a wide range of devices. The friendly All-in-One For Dummies format is a perfect way to present it. Each minibook is a self-contained package of necessary information, making it easy to find what you're looking for.
Upgrades in C# 2010 include the ability to build Windows 7 applications and compatibility with Python and Ruby.
C# is a somewhat complex programming language for building .NET-connected software for Microsoft Windows, the Web, and other devices Beginning C# programmers will appreciate how the All-in-One format breaks the topic into minibooks, each one addressing a key body of information Minibooks include creating your first C# program, Windows 7 programming, basic C# programming, object-based programming, object-oriented programming, Windows programming with C# and Visual Studio, and debugging Companion Web site includes all sample code Beginning C# programmers will find C# 2010 All-in-One For Dummies explains a complicated topic in an easy, understandable way.
Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.
Author(s): Bill Sempf; Charles Sphar; Stephen Randy Davis
Series: For Dummies
Publisher: For Dummies
Year: 2010
Language: English
Pages: 864
C# 2010 All-In-One For Dummies®
About the Authors
Dedication
Acknowledgments
Table of Contents
Introduction
Book I: Basics of C# Programming
Chapter 1: Creating Your First C# Console Application
Getting a Handle on Computer Languages, C#, and .NET
Creating Your First Console Application
Making Your Console App Do Something
Reviewing Your Console Application
Introducing the Toolbox Trick
Chapter 2: Living with Variability — Declaring Value-Type Variables
Declaring a Variable
What’s an int?
Representing Fractions
Handling Floating-Point Variables
Using the Decimal Type: Is It an Integer or a Float?
Examining the bool Type: Is It Logical?
Checking Out Character Types
What’s a Value Type?
Comparing string and char
Calculating Leap Years: DateTime
Declaring Numeric Constants
Changing Types: The Cast
Letting the C# Compiler Infer Data Types
Chapter 3: Pulling Strings
The Union Is Indivisible, and So Are Strings
Performing Common Operations on a String
Comparing Strings
What If I Want to Switch Case?
Looping through a String
Searching Strings
Getting Input from the Command Line
Controlling Output Manually
Formatting Your Strings Precisely
StringBuilder: Manipulating Strings More Efficiently
Chapter 4: Smooth Operators
Performing Arithmetic
Performing Logical Comparisons — Is That Logical?
Matching Expression Types at TrackDownAMate.com
Chapter 5: Getting Into the Program Flow
Branching Out with if and switch
Here We Go Loop-the-Loop
Looping a Specified Number of Times with for
Nesting Loops
Don’t goto Pieces
Chapter 6: Lining Up Your Ducks with Collections
The C# Array
A Loop Made
Array
Sorting Arrays of Data
New Feature: Using var for Arrays
Loosening Up with C# Collections
Understanding Collection Syntax
Using Lists
Using Dictionaries
Array and Collection Initializers
Using Sets
On Not Using Old-Fashioned Collections
Chapter 7: Stepping through Collections
Iterating through a Directory of Files
Iterating
Collections: Iterators
Accessing Collections the Array Way: Indexers
Looping Around the Iterator Block
Chapter 8: Buying Generic
Writing a New Prescription: Generics
Classy Generics: Writing Your Own
Chapter 9: Some Exceptional Exceptions
Using an Exceptional Error-Reporting Mechanism
Throwing Exceptions Yourself
Knowing What Exceptions Are For
Can I Get an Exceptional Example?
Assigning Multiple catch Blocks
Planning Your Exception-Handling Strategy
Grabbing Your Last Chance to Catch an Exception
Book II: Object-Oriented C# Programming
Chapter 1: Object-Oriented Programming: What’s It All About?
Object-Oriented Concept # 1: Abstraction
Object-Oriented Concept # 2: Classification
Why Classify?
Object-Oriented Concept # 3: Usable Interfaces
Object-Oriented Concept # 4: Access Control
How C# Supports Object-Oriented Concepts
Chapter 2: Showing Some Class
Defining a Class and an Object
Accessing the Members of an Object
An Object-Based Program Example
Discriminating between Objects
Can You Give Me References?
Classes That Contain Classes Are the Happiest Classes in the World
Generating Static in Class Members
Defining const and readonly Data Members
Chapter 3: We Have Our Methods
Defining and Using a Method
A Method Example for Your Files
Having Arguments with Methods
Returning Values after Christmas
Chapter 4: Let Me Say This about
Passing an Object to a Method
Defining Methods
Accessing the Current Object
Chapter 5: Holding a Class Responsible
Restricting Access to Class Members
Why You Should Worry about Access Control
Defining Class Properties
Getting Your Objects Off to a Good Start — Constructors
The C#-Provided Constructor
Replacing the Default Constructor
Chapter 6: Inheritance: Is That All I Get?
Class Inheritance
Why You Need Inheritance
Inheriting from a BankAccount Class ( A More Complex Example)
IS_ A versus HAS_A — I’m So Confused_A
When to IS_A and When to HAS_A
Other Features That Support Inheritance
The object Class
Inheritance and the Constructor
The Updated BankAccount Class
Chapter 7: Poly-what-ism?
Overloading an Inherited Method
Polymorphism
The Class Business Card: ToString()
C# During Its Abstract Period
Sealing a Class
Chapter 8: Interfacing with the Interface
Introducing CAN_ BE_USED_AS
Knowing What an Interface Is
Using an Interface
Using the C# Predefined Interface Types
Looking at a Program That CAN_ BE_ USED_ AS an Example
Unifying Class Hierarchies
Hiding Behind an Interface
Inheriting an Interface
Using Interfaces to Manage Change in Object-Oriented Programs
Chapter 9: Delegating Those Important Events
E.T., Phone Home — The Callback Problem
Defining a Delegate
Pass Me the Code, Please — Examples
A More Real-World Example
Shh! Keep It Quiet — Anonymous Methods
Stuff Happens — C# Events
Chapter 10: Can I Use Your Namespace in the Library?
Dividing a Single Program into Multiple Source Files
Dividing a Single Program into Multiple Assemblies
Putting Your Classes into Class Libraries
Going Beyond Public and Private: More Access Keywords
Putting Classes into Namespaces
Book III: Designing for C#
Chapter 1: Writing Secure Code
Designing Secure Software
Building Secure Windows Applications
Building Secure Web Forms Applications
Using System.Security
Chapter 2: Accessing Data
Getting to Know System. Data
How the Data Classes Fit into the Framework
Getting to Your Data
Using the System.Data Namespace
Chapter 3: Fishing the FileStream
Going Where the Fish Are: The File Stream
StreamWriting for Old Walter
Pulling Them Out of the Stream: Using StreamReader
More Readers and Writers
Exploring More Streams than Lewis and Clark
Chapter 4: Accessing the Internet
Getting to Know System.Net
How Net Classes Fit into the Framework
Using the System.Net Namespace
Chapter 5: Creating Images
Getting to Know System. Drawing
How the Drawing Classes Fit into the Framework
Using the System. Drawing Namespace
Book IV: A Tour of Visual Studio
Chapter 1: Getting Started with Visual Studio
Versioning the Versions
Installing Visual Studio
Breaking Down the Projects
Chapter 2: Using the Interface
Designing in the Designer
Paneling the Studio
Coding in Code View
Using the Tools of the Trade
Chapter 3: Customizing Visual Studio
Setting Options
Using Snippets
Hacking the Project Types
Chapter 4: Transforming Text Templates
Getting to Know T4
Figuring Out When to Use T4
Setting Up the Environment
Using Some of the T4 Directives
Book V: Windows Development with WPF
Chapter 1: Introducing WPF
Understanding What WPF Can Do
Introducing XAML
Diving In! Creating Your First WPF Application
Whatever XAML Can Do, C# Can Do Better!
Chapter 2: Understanding the Basics of WPF
Using WPF to Lay Out Your Application
Arranging Elements with Layout Panels
Exploring Common XAML Controls
Chapter 3: Data Binding in WPF
Getting to Know Dependency Properties
Exploring the Binding Modes
Investigating the Binding Object
Editing, Validating, Converting, and Visualizing Your Data
Finding Out More about WPF Data Binding
Chapter 4: Practical WPF
Commanding Attention
Get Your ViewModel On
Book VI: Web Development with ASP.NET
Chapter 1: Looking at How ASP.NET Works with C#
Breaking Down Web Applications
Questioning the Client
Dealing with Web Servers
Chapter 2: Building Web Applications
Working in Visual Studio
Developing with Style
Chapter 3: Controlling Your Development Experience
Showing Stuff to the User
Getting Some Input from the User
Data Binding
Styling Your Controls
Making Sure the Site Is Accessible
Constructing User Controls
Adding Custom Controls
Chapter 4: Leveraging the . NET Framework
Surfing Web Streams
Securing with ASP.NET
Navigating with Site Maps
Managing Files
Baking Cookies
Tracing with TraceContext
Chapter 5: Digging into Web Construction
Managing Files
Mastering Master Pages
Testing Web Applications with Visual Studio
Deploying Your Masterpiece
Book VII: Service-Oriented Development
Chapter 1: Getting Acquainted with Web Services
Understanding Web Services
Building Service-Oriented Applications
Providing XML Web Services
Building Three Sample Apps
Chapter 2: Building Web Services with ASMX
Getting to Know SOAP
Making an ASMX Service
Chapter 3: Building Web Services with WCF
Getting to Know WCF
Creating a WCF Service
Chapter 4: Building Web Services with ReST
Getting to Know ReST
Understanding the Guiding Principles of ReST
Changing a WCF Service to Use ReST
Book VIII: New Features in C# 4.0
Chapter 1: Programming Dynamically!
Shifting C# Toward Dynamic Typing
Programming Dynamically
Putting Dynamic to Use
Running with the Dynamic Language Runtime
Chapter 2: Improving Productivity with Named and Optional Parameters
Optional Parameters
Named Parameters
Overload Resolution
Chapter 3: Helping Out with Interop
Using Dynamic Import
Working without Primary Interop Assemblies
Skipping the Ref Statement
Chapter 4: Revising Generics
Variance
Contravariance
Covariance
Index