Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Title
Contents
Introduction
What’s New in C# 3.0
About This Book
What You Need to Use the Book
How to Use This Book
How This Book Is Organized
Icons Used in This Book
Conventions Used in This Book
Where’s the Code? And the Bonus Goodies?
Where to Go from Here
Part I : Getting Started with C#
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
Part II : Basic C# Programming
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
Is This a Leap Year? — DateTime
Declaring Numeric Constants
Changing Types — The Cast
New Feature: Letting the C# Compiler Infer Data Types
Chapter 3: Smooth Operators
Performing Arithmetic
Performing Logical Comparisons — Is That Logical?
Matching Expression Types at TrackDownAMate.com
Chapter 4: 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 5: Lining Up Your Ducks with Collections
The C# Array
A Loop Made foreach Array
Sorting Through Arrays of Data
New Feature — Using var for Arrays
Loosening Up with C# Collections
Understanding Collection Syntax
Using Lists
Using Dictionaries
New Feature — Array and Collection Initializers
New Feature — Using Sets
On Not Using Old-Fashioned Collections
Chapter 6: 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
Part III : Using Objects
Chapter 8: We Have Our Methods
Defining and Using a Method
An Example Method for Your Files
Having Arguments with Methods
Passing Value-Type and Reference-Type Arguments
Returning Values after Christmas
Chapter 9: Let Me Say This about this
Passing an Object to a Method
Defining Methods
Accessing the Current Object
New Feature: Extension Methods
Chapter 10: 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 Does C# Support Object-Oriented Concepts?
Part IV : Object-Oriented Programming
Chapter 11: Holding a Class Responsible
Restricting Access to Class Members
Why Worry about Access Control?
Defining Class Properties
Getting Your Objects Off to a Good Start — Constructors
The C#-Provided Constructor
Replacing the Default Constructor
Overloading the Constructor (Is That Like Overtaxing a Carpenter?)
Avoiding Duplication among Constructors
Being Object-Stingy
Chapter 12: Inheritance — Is That All I Get?
Inheriting a Class
Why Do You Need Inheritance?
A More Involved Example — Inheriting from a BankAccount Class
IS_A versus HAS_A — I’m So Confused
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 13: Poly-what-ism?
Overloading an Inherited Method
Polymorphism
The Class Business Card: ToString()
C# During Its Abstract Period
Sealing a Class
Chapter 14: Interfacing with the Interface
What Is CAN_BE_USED_AS?
What Is an Interface?
Using an Interface
Using C#’s Predefined Interface Types
Can I See 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
Part V : Now Showing in C# 3.0
Chapter 15: Delegating Those Important Events
E.T. Phone Home — The Callback Problem
What’s a Delegate?
Pass Me the Code, Please — Examples
How About a More Real-World Example?
Shh! Keep It Quiet — Anonymous Methods
Stuff Happens — C# Events
Chapter 16: Mary Had a Little Lambda Expression
Collections and the Do-to-Each Problem
New Feature: Using Lambda Expressions
Using Lambda Expressions for Any Delegate
Chapter 17: LINQing Up with Query Expressions
Reviewing the C# 3.0 Features
What’s a Query, and Why Should I Care?
Querying in C# 3.0
What Can I Do with a Query?
Filtering Out the Espresso Grounds
Selecting and Grouping What You Want
Sorting the Stuff You Select
Is There Any Method to Querying?
Counting, Summing, Averaging, and Stuff Like That
Treating an Object Like a Collection
Part VI : The Part of Tens
Chapter 18: Ten Common Build Errors (And How to Fix Them)
: Further Reading
← Prev
Back
Next →
← Prev
Back
Next →