Table of Contents
1 Getting started 7
Introducing C# 8
Installing Visual Studio 10
Exploring the IDE 12
Starting a Console project 14
Running a Console project 16
Following the rules 18
Summary 20
2 Storing values 21
Creating variables 22
Reading input 24
Employing arrays 26
Casting data types 28
Fixing constants 30
Summary 32
3 Performing operations 33
Doing arithmetic 34
Assigning values 36
Comparing values 38
Assessing logic 40
Examining conditions 42
Setting precedence 44
Summary 46
4 Making statements 47
Branching with if 48
Switching branches 50
Looping for 52
Looping while 54
Iterating for each 56
Summary 58
5 Devising methods 59
Creating function 60
Passing arguments 62
Overloading methods 64
Refactoring code 66
Summary 68
6 Handling strings 69
Discovering string features 70
Manipulating strings 72
Joining and comparing strings 74
Copying and swapping strings 76
Finding substrings 78
Formatting strings 80
Formatting date strings 82
Summary 84
7 Accessing files 85
Writing a file 86
Appending to a file 88
Reading text and lines 90
Streaming lines 92
Manipulating input and output 94
Summary 96
8 Solving problems 97
Detecting real-time errors 98
Fixing compile-time errors 100
Debugging code 102
Setting breakpoints 104
Catching runtime errors 106
Getting help 108
Summary 110
9 Creating objects 111
Encapsulating data 112
Creating multiple objects 114
Initializing class members 116
Inheriting class properties 118
Calling base constructors 120
Hiding base methods 122
Directing method calls 124
Providing capability classes 126
Employing partial classes 128
Summary 130
10 Controlling events 131
Starting a Forms project 132
Adding visual controls 134
Writing functional code 136
Gathering text entries 138
Ticking option boxes 140
Showing user messages 142
Calling system dialogs 144
Creating application menus 146
Making menus work 148
Importing audio resources 150
Summary 152
11 Building an application 153
Planning the program 154
Assigning fixed properties 156
Designing the layout 158
Setting dynamic properties 160
Adding runtime function 162
Testing the program 164
Publishing the application 166
Summary 168
12 Targeting devices 169
Starting a Universal project 170
Inserting page components 172
Importing program assets 174
Designing the layout 176
Adding runtime function 178
Testing the program 180
Adjusting the interface 182
Deploying the application 184
Summary 186
Index 187