a escape sequence, 181
(+) addition operator, 60
b escape sequence, 181
<%# %> data binding expressions, 432
(--) decrement operator, 62
<%@ %> directives, 432
(/) division operator, 60
<% %> embedded code block, 432
#endif preprocessor symbol, 444
\ escape sequence, 181
“ escape sequence, 181
’ escape sequence, 181
0 escape sequence, 181
f escape sequence, 181
#if preprocessor symbol, 444
(++) increment operator, 62
(*) multiplication operator, 60
n escape sequence, 181
r escape sequence, 181
<%- - %> server side comments, 432
( / ) slash character, 392
(-) subtraction operator, 60
t escape sequence, 181
<%= %> text data, 432
uxxxx escape sequence, 181
uxxxxxxxx escape sequence, 181
v escape sequence, 181
absolute paths, 304
AbsoluteUri method, 58
internal access, 83
private access, 83
protected access, 83
protected internal access, 83
public access, 83
AccessViolationException, 240
Add method, 57
Collection<T> class, 214
Dictionary<TKey, TValue> class, 220
HashSet<T> class, 219
List<T> collection, 215
SortedDictionary<TKey, TValue> class, 221
SortedList<TKey, TValue> class, 221
SortedSet<T> class, 219
XML modification, 340
AddDays method, 55
AddHours method, 55
addition (+) operator, 60
additive operator, 61
AddMinutes method, 55
AddMonths method, 55
AddRange method, 215
AddYears method, 55
ADO.NET, 346
connection pooling, 349
data providers, 347
DataSet class, 346
read-only database access, 348
required references, 348
sample application, 350
SQL injection attacks, 349
Aggregate ( ) operator, 487
And (conditional) (&&) operator, 64
And (logical) (&) operator, 64
animation (WPF), 372
anonymous methods, 152
anonymous types, 286
APIs (application programming interfaces), 404. See also specific APIs
app bar (Windows Store apps), 406-407
AppendAllLines method, 313
AppendAllText method, 313
AppendText method
File class, 313
FileInfo class, 308
Application class, 369
Application_AuthenticateRequest method, 423
Application_BeginRequest method, 423
ApplicationData folder, 305
Application_End method, 423
Application_Error method, 423
applications
Web applications, 420
browser communication, 420
Global.asax event handlers, 423
inline styles, 430
Page event handlers, 422
enterprise access to, 407
porting a desktop application to, 414-417
Snap view, 405
user interface considerations, 413
Collection Editor, 377
document outline, 375
New Project dialog box, 373
Properties window, 375
rows/columns, creating, 376
rows/colums, definitions for, 377
rows/colums, star sizing, 378
Visual Studio, 372
XAML designer, 374
Application_Start method, 423
App.xaml file, 381
ArgumentException, 240
ArgumentOutOfRangeException, 240
arguments
order of, 95
positional, 95
addition (+), 60
decrement (--), 62
division (/), 60
increment (++), 62
multiplication (*), 60
sample application, 63
subtraction (-), 60
declaring, 206
generics combined with, 273-274
indexing, 208
jagged, 207
multidimensional, 207
single-dimensional, 207
size of, 206
System.Array class, 210
AsOrdered ( ) operator, 487
AsParallel ( ) operator, 487
embedded ASP.NET code blocks, 432
Model View Controller (MVC) Framework, 420
Web Forms, 420
assembly manifest, 445
assembly target, 439
AssemblyCompany attribute, 445
AssemblyConfiguration attribute, 445
AssemblyCopyright attribute, 445
AssemblyCulture attribute, 445
AssemblyDefaultAlias attribute, 445
AssemblyDescription attribute, 445
AssemblyFileVersion attribute, 445
AssemblyFlags attribute, 445
AssemblyInformationVersion attribute, 445
AssemblyName attribute, 445
AssemblyProduct attribute, 445
AssemblyTitle attribute, 445
AssemblyTrademark attribute, 445
AssemblyVersion attribute, 445
AsSequential ( ) operator, 487
assignment (=) operator, 61, 60-63
compound, 60
sample application, 63
associating data templates, 400
naming conventions, 411
sample application, 410
threads and, 408
atomization, 333
assembly manifest, 445
Caller Info attributes, 440-442
common attributes
Obsolete, 443
retrieving, 447
multiple attributes, accessing, 448
naming conventions, 438
parameters, 439
runtime, accessing attributes at, 447-448
targets, 439
Attributes method, 308
automatic properties, 86
BCL (Base Class Libraries), 9
BigInteger type, 59
BinarySearch method
List<T> collection, 215
System.Array class, 210
Bind method, 432
BlockingCollection<T> class, 484
bool type, 51
Boolean values, 52
break statement, 172
browser-hosted applications, 369, 420
bubbling strategy to route events, 368
buffered streams, 303, 316-318
BufferedStream class, 316
byte type, 51
expressions, 15
statements, 15
C++ templates, 265
Caller Info attributes, 440-442
CallerFilePathAttribute, 440
CallerLineNumberAttribute, 440
CallerMemberNameAttribute, 440-442
calling generic methods, 269-270
camel casing notation, 19
CanRead method, 315
Canvas (WPF layout), 370
CanWrite method, 315
Capacity method
List<T> collection, 215
SortedList<TKey, TValue> class, 221
Capture class, 201
cascaded if statement, 161
Cascading Style Sheets (CSS), 429-430
case sensitivity, 185
cast operator, 71
catch handler, 243
ChangeExtension method, 304
char type, 51
character escape sequences, 181
children nodes, 339
CIL (Common Intermediate Language), 7, 265
classes, 79
internal access, 83
private access, 83
protected access, 83
protected internal access, 83
public access, 83
generics, 271
creating, 271
interfaces compared, 272
structs compared, 272
methods, 88
as input, 91
named arguments, 95
parameters, 90
sample application, 93
signatures, 91
nested, 101
object initializers, 104
automatic, 86
read-only, 87
sample application, 89
write-only, 87
structures compared, 136, 142-143
Clear method
Collection<T> class, 214
Dictionary<TKey, TValue> class, 220
HashSet<T> class, 219
List<T> collection, 215
Queue<T> class, 227
SortedDictionary<TKey, TValue> class, 221
SortedList<TKey, TValue> class, 221
SortedSet<T> class, 219
Stack<T> class, 224
System.Array class, 210
ClearItems method, 218
client-side validation, 433-435
CompareValidator control, 433
CustomValidator control, 433
RangeValidator control, 433
RegularExpressionValidator control, 433
RequiredFieldValidator control, 433
Close method, 315
closing streams, 309
CLR (common language runtime), 6
CIL (common intermediate language), 7
memory management, automatic, 8-9
VES (virtual execution system), 7-8
CLS-compliance and type, 53
CLSCompliant attribute, 445
Collection Editor, 377
collections, 205
declaring, 206
indexing, 208
jagged, 207
multidimensional, 207
single-dimensional, 207
size of, 206
System.Array class, 210
Collection<T>, 214
sample application, 214
sample application, 222
implementing, 390
LinkedList<T>, 214
ReadOnlyCollection<T>, 219
stacks, 224
Collection<T>, 214
sample application, 214
CollectionViewSource class, 388
columns/rows
creating, 376
definitions for, 377
star sizing, 378
Combine method, 304
COMException, 240
comments (code), 44
delimited, 45
multiline, 45
common attributes
Obsolete, 443
Common Intermediate Language (CIL), 7, 265
common language runtime. See CLR (common language runtime)
CommonApplicationData folder, 305
CommonDocuments folder, 305
Compare method, 58
CompareOrdinal method, 185
CompareValidator control, 433
compatibility, regular expressions, 199
composite formatting, strings, 198
compound assignment (=) operator, 60
computer-oriented programming, 79
Concat method, 188
concatenation
query expressions (LINQ), 285-286
strings, 188
concurrency
data parallelism, 484
Task Parallel Library (TPL), 481
PLINQ (Parallel LINQ), 487-488
threads, 477
ConcurrentBag<T> class, 484
ConcurrentDictionary<TKey, TValue> class, 484
ConcurrentQueue<T> class, 484
ConcurrentStack<T> class, 484
conditional AND operator, 61
Conditional attribute, 443-444
conditional operator, 61, 65-66
conditional OR operator, 61
connection pooling, 349
constructors
inheritance
chaining constructors, 117
default constructors, 114
in derived classes, 116
overloading, 98
Contains method, 185
Collection<T> class, 214
HashSet<T> class, 219
List<T> collection, 215
Queue<T> class, 227
ReadOnlyCollection<T> class, 219
SortedSet<T> class, 219
Stack<T> class, 224
ContainsKey method
Dictionary<TKey, TValue> class, 220
SortedDictionary<TKey, TValue> class, 221
SortedList<TKey, TValue> class, 221
ContainsValue method
Dictionary<TKey, TValue> class, 220
SortedDictionary<TKey, TValue> class, 221
SortedList<TKey, TValue> class, 221
continue statement, 174
Contract.Result<T> class, 256-257
controls
CompareValidator control, 433
CustomValidator control, 433
RangeValidator control, 433
RegularExpressionValidator control, 433
RequiredFieldValidator control, 433
ControlToValidate property, 434
dynamic types, 454
sample application, 72
ConverterParameter property, 396
Copy method, 313
CopyTo method
FileInfo class, 308
Stream class, 315
corrupted state, 250
Count method
Collection<T> class, 214
Dictionary<TKey, TValue> class, 220
HashSet<T> class, 219
List<T> collection, 215
Queue<T> class, 227
ReadOnlyCollection<T> class, 219
SortedDictionary<TKey, TValue> class, 221
SortedList<TKey, TValue> class, 221
SortedSet<T> class, 219
Stack<T> class, 224
Create method
DirectoryInfo class, 306
File class, 313
FileInfo class, 308
CreateDirectory method, 311
CreateNavigator method, 335
CreateSubdirectory method, 306
CreateText method
File class, 313
FileInfo class, 308
CSS (Cascading Style Sheets), 429-430
current item pointers for data binding, 392
retrieving, 447
custom dynamic objects
creating, 458
custom dynamic types, 459
custom format strings, 195
CustomValidator control, 433
adding binding expressions, 431
Bind method, 432
collections, implementing, 390
components, 386
current item pointers, 392
OneTime, 386
OneWayToSource, 386
SortDescription structure, 389
target, 386
WPF, 372
ConverterParameter property, 396
multivalue converters, 394-396
concurrent collections, 484
thread-safe collections, 483-484
data providers, 347
data streams. See streams
associating, 400
defining, 399
client-side validation
CompareValidator control, 433
CustomValidator control, 433
RangeValidator control, 433
RegularExpressionValidator control, 433
RequiredFieldValidator control, 433
ControlToValidate property, 434
Display property, 434
ErrorMessage property, 434
Text property, 434
client-side validation, 433-435
server-side validation, 432-433
databases, 343
ADO.NET, 346
connection pooling, 349
data providers, 347
DataSet class, 346
read-only database access, 348
required references, 348
sample application, 350
SQL injection attacks, 349
AdventureWorks sample database, 343-345
LINQ to ADO.NET, 351
DataContext class, customizing, 358-359
DataSet class, 346
Date property, 55
arithmetic methods, 55
properties, 55
Day property, 55
DayOfWeek property, 55
Days method, 57
deadlocks, 477
execution of program, controlling, 40-43
Immediate window, 38
tracepoints, 40
unit tests, 46
declaring
catch handler, 243
indexers, 211
interfaces, 122
structures, 136
decoding and encoding characters in XML (Extensible Markup Language), 329
decrement (--) operator, 62
default constructors, 97
default layout controls (WPF layout), 370
deferred execution, 301
defining data templates, 399
delegates, 148
replacement with lambdas, 297-298, 300
Delete method
Directory class, 311
DirectoryInfo class, 306
File class, 313
FileInfo class, 308
delimited comments, 45
DependencyObject, 386
Dequeue method, 227
derivation. See inheritance
designing class hierarchies, 112
desktop applications
Collection Editor, 377
document outline, 375
New Project dialog box, 373
Properties window, 375
rows/columns, creating, 376
rows/columns, definitions for, 377
rows/columns, star sizing, 378
Visual Studio, 372
XAML designer, 374
Desktop folder, 305
DesktopDirectory folder, 305
sample application, 222
Dictionary<TKey, TValue> class, 219-220
direct strategy to route events, 368
directories
DirectoryInfo class, 306-307, 310
File class, 312
paths, 304
special, 305
Directory method, 308
DirectoryInfo class, 306-307, 310
DirectoryName method, 308
Display property, 434
disposable types, 468
division (/) operator, 60
DLR (dynamic language runtime), 11-13, 451, 456-457
custom dynamic objects
creating, 458
ExpandObject class, 457
IDynamicMetaObjectProvider interface, 457
sample application, 167
syntax, 167
DockPanel (WPF layout), 370-371
document outline, 375
documents in WPF, 372
DOM (Document Object Model) XML, 326-327
queries, 335
double type, 51
downloading
SQL Server, 343
SQL Server Express, 343
dynamic language runtime. See DLR (dynamic language runtime)
dynamic languages, 13
conversions, 454
creating, 459
custom, 459
reflection interoperability, 461-462
runtime, determining dynamic types at, 454
editions, 26
Eiffel programming language, 254-255
embedded ASP.NET code blocks, 432
Empty method, 56
encoding and decoding characters in XML (Extensible Markup Language), 329
EndsWith method, 186
Enqueue method, 227
Enter method, 479
enterprise access to Windows Store apps, 407
EntityClient data provider, 360
EnumerateDirectories method
Directory class, 311
DirectoryInfo class, 306
EnumerateFiles method
Directory class, 311
DirectoryInfo class, 306
EnumerateFileSystemEntries method, 311
EnumerateFileSystemInfos method, 306
defining, 130
multiple named values, 131
sample application, 133
underlying type, 132
zero value, 132
equality operator, 61
equals (==) operator, 62
ErrorMessage property, 434
errors. See also exceptions
return codes used to report, 237
EscapeUriString method, 58
event target, 439
event-driven programming, 147. See also events
bubbling strategy to route events, 368
delegates, 148
direct strategy to route events, 368
handlers
multithreaded, 156
post-events, 154
pre-events, 154
routed, 368
tunneling strategy to route events, 368
exceptions, 238. See also specific exceptions
Contract.Result<T> class, 256-257
corrupted state, 250
finally handler, 242
integer arithmetic operations, overflowing, 252-253
multiple, catching, 244
preconditions, 255
pure methods, 258
RuntimeWrappedException, 238
standard, 239
swallowing, 244
validating arguments, 239
wrapping, 251
ExceptWith method
HashSet<T> class, 219
SortedSet<T> class, 219
exclusive locks, 478
execution of program, controlling, 40-43
ExecutionEngineException, 240
Exists method
Directory class, 311
DirectoryInfo class, 306
File class, 313
FileInfo class, 308
List<T> collection, 215
System.Array class, 210
ExpandObject class, 457
explicit conversions, 138
explicit interface implementation, 125-126
expressions, 15
to avoid, 478
Extensible Application Markup Language (XAML), 366-367
browser applications, 369
CollectionViewSource class, 388
photo viewer application layout, 379-380
x:Class attribute, 367
x:Name attribute, 380
Extensible Markup Language. See XML (Extensible Markup Language)
Extension method, 308
extension methods, 102-103, 123
fall through switch statement, 164
FCL (framework class library), 9
sample application, 85
target, 439
File class, 312
files, 303
DirectoryInfo class, 306-307, 310
File class, 312
reading and writing data using, 320-321
paths, 304
absolute, 304
Path class, 304
relative, 304
reading and writing data, 314-321
StreamWriter class, 318
text, 318
filtering data, 287
Find method
List<T> collection, 215
System.Array class, 210
FindAll method
List<T> collection, 215
System.Array class, 210
float type, 51
Flush method, 315
for statement, 168-169, 482-483
infinite loops, 168
initializer declaration space, 168
sample application, 169
syntax, 168
while statement compared, 169
ForAll( ) operator, 487
List<T> collection, 215
System.Array class, 210
foreach statement, 170-171, 230, 482-483
compiler expanded, 230
iteration variable, 170
sample application, 171
syntax, 170
Fragment property, 58
FromDays method, 57
FromHours method, 57
FromMilliseconds method, 57
FromMinutes method, 57
FromSeconds method, 57
FullName method
DirectoryInfo class, 306
FileInfo class, 308
garbage collection, 8-9, 466-467
IDisposable interface, 467-469
generics
C++ templates compared, 265
classes, 271
creating, 271
interfaces compared, 272
structs compared, 272
interfaces, variance in, 274-278
Java generics compared, 265
methods, 269
in nongeneric classes, 269
type inference used for calling, 270
type parameters, hiding, 269
minimum value, finding, 263-266
tuples, 278
type parameters, 265
value equity, testing for, 267-268
variant generic interfaces, 274-278
get accessor (indexers), 211
GetAttributes method, 313
GetCurrentDirectory method, 311
GetDirectoryName method, 304
GetDirectoryRoot method, 311
GetExtension method, 304
GetFileName method, 304
GetFileNameWithoutExtension method, 304
GetLogicalDrives method, 311
GetParent method, 311
GetPathRoot method, 304
GetRandomFileName method, 304
GetTempFileName, 304
GetTempPath method, 304
Global.asax event handlers, 423
Golde, Peter, 1
graphics, 371
greater than (>) operator, 62
greater than or equals (>=) operator, 62
Grid (WPF layout), 370
GridView.Tapped event handler, 415
Group class, 201
GUIDs (globally unique identifiers), 56
finally handler, 242
HashSet<T> class, 219
Hejlsberg, Anders, 1
hiding base class members, 119-120
Host property, 58
Hour property, 55
Hours method, 57
IBindingList view, 389
ICollection<T> interface, 229
IComparer<T> interface, 229
IDictionary<TKey, TValue> interface, 229
IDisposable interface, 467-469
IDynamicMetaObjectProvider interface, 457
IEnumerable view, 389
IEnumerable<T> interface, 229, 230-231
IEnumerator<T> interface, 230-231
IEqualityComparer<T> interface, 230
cascaded, 161
“mismatched else” problem, 161
nested, 160
sample application, 161
syntax, 160
IIS (Internet Information Services), 422
IList view, 389
IList<T> interface, 229
Immediate window, 38
implementation inheritance, 111-112
implicit conversions, 68-70, 138
increment (++) operator, 62
indexers, 211
declaring, 211
get accessor, 211
modifiers, 211
syntax, 211
IndexOf method, 219
IndexOutOfRangeException, 240
infinite loops, 168
constructors
chaining, 117
default, 114
in derived classes, 116
designing class hierarchies, 112
hiding base class members, 119-120
multiple, 110
overriding base class members, 116-118
sample application, 115
sample application, 115
sealing classes, 120
initializer declaration space, 168
initializing structures, 139
inline styles for Web applications, 430
input, methods as, 91
InsertItem method, 218
integer arithmetic operations, overflowing, 252-253
declaring, 122
explicit interface implementation, 125-126
extension methods, 123
generic classes compared, 272
sample application, 123
variance in generic interfaces, 274-278
interlocked operations, 480
internal access, 83
IntersectWith method
HashSet<T> class, 219
SortedSet<T> class, 219
InvalidOperationException, 240
IronPython, 462
ISet<T> interface, 229
IsFile method, 58
IsProperSubsetOf method
HashSet<T> class, 219
SortedSet<T> class, 219
IsProperSupersetOf method
HashSet<T> class, 219
SortedSet<T> class, 219
IsReadOnly method, 308
IsSubsetOf method
HashSet<T> class, 219
SortedSet<T> class, 219
IsSupersetOf method
HashSet<T> class, 219
SortedSet<T> class, 219
items, 28
iteration statements, 165
sample application, 167
syntax, 167
iteration variable, 170
sample application, 171
syntax, 170
infinite loops, 168
initializer declaration space, 168
sample application, 169
syntax, 168
while statement compared, 169
sample application, 166
for statement compared, 169
syntax, 165
iteration variable, 170
Java generics, 265
JIT (Just-In-Time) compiler, 8, 265
Join method, 188
joining
break statement, 172
continue statement, 174
return statement, 175
Keys method, 220
keywords, 19
contextual, 19
list of, 19
lambda operator, 61
delegate replacement, 297-298, 300
variables, capturing, 298
language interoperability, 137
layouts
creating
Canvas, 370
default layout controls, 370
Grid, 370
resource dictionaries, 381-382
StackPanel, 370
WrapPanel, 370
lazy evaluation, 301
Length method, 308
less than (<) operator, 62
less than or equals (<=) operator, 62
lifetime, 16
LinkedList<T>, 214
LINQ (Language Integrated Query), 283-284
anonymous type, returning, 286
deferred execution, 301
filtering data, 287
lazy evaluation, 301
standard query operator methods, 296-297
syntax, 285
LINQ to ADO.NET, 351
queries, 352
required references, 352
EntityClient data provider, 360
queries, 361
adding new records, 357
DataContext class, customizing, 358-359
namespaces, required, 354
object model, creating, 353
queries, 354
selecting data, 354
updating records, 357
LINQ to DataSet, 351
queries, 352
required references, 352
EntityClient data provider, 360
queries, 361
LINQ to SQL, 353
adding new records, 357
DataContext class, customizing, 358-359
namespaces, required, 354
object model, creating, 353
queries, 354
selecting data, 354
updating records, 357
LINQ to XML, 327
creating XML with, 328
SetAttributeValue class, 330-331
SetElementValue class, 330-331
XDocument class, 327
literals
character escape sequences, 181
verbatim, 181
LocalApplicationData folder, 305
LocalPath method, 58
lock statement, 478
Enter method, 479
example, 478
expressions to avoid, 478
Monitor class, 479
Spinlock class, 480
Wait method, 479
locks, 477
exclusive, 478
lock statement, 478
Enter method, 479
example, 478
expressions to avoid, 478
Monitor class, 479
Spinlock class, 480
Wait method, 479
reader-writer locks, 481
logical operators, 64
And (conditional) (&&), 64
And (logical) (&), 64
Not (!), 64
Or (conditional) (||), 64
Or (exclusive) (^), 64
Or (logical) (|), 64
sample application, 64
short-circuit evaluation, 64
truth table, 64
XOR, 61
MakeRelativeUri, 58
manipulation of strings, 183-189
master pages for Web applications, 426-427
Match class, 200
MatchCollection class, 200
Max method, 219
media, 372
IDisposable interface, 467-469
methods, 88
anonymous, 152
generics, 269
in nongeneric classes, 269
type inference used for calling, 270
type parameters, hiding, 269
as input, 91
named arguments, 95
parameters, 90
output, 90
reference, 90
required, 94
value, 90
sample application, 93
signatures, 91
target, 439
Microsoft’s Professional Developer Conference (PDC), 1
Milliseconds method, 57
Min method, 219
minimum value, finding, 262
with objects, 262
Minute property, 55
Minutes method, 57
“mismatched else” problem, 161
Model View Controller (MVC) Framework, 420
modifiers, 211
modifying
XML (Extensible Markup Language), 338-341
module target, 439
Monitor class, 479
Month property, 55
Move method
Directory class, 311
File class, 313
MoveTo method
DirectoryInfo class, 306
FileInfo class, 308
multiline comments, 45
multiple attributes, accessing, 448
multiple exceptions, 244
multiple inheritance, 110
multiple named values, 131
multiple threads, 476
multiplication (*) operator, 60
multiplicative operator, 61
multithreaded events, 156
multivalue converters, 394-396
mutex, 481
MVC (Model View Controller) Framework, 420
MyDocuments folder, 305
Name method
DirectoryInfo class, 306
FileInfo class, 308
named arguments, 95
LINQ to SQL, 354
System, 12
System.Collections.Generic, 12
System.Data, 12
System.Diagnostics, 12
System.Globalization, 12
System.IO, 12
System.Linq, 12
System.Net, 12
System.Security, 12
System.ServiceModel, 12
System.Text, 12
System.Web, 12
System.Windows, 12
System.Windows.Controls, 12
System.Windows.Forms, 12
System.Xml, 12
XML (Extensible Markup Language), 331
atomization, 333
sample application, 334
naming conventions
asynchrony, 411
attributes, 438
strings, 179
nested classes, 101
nested if statement, 160
CLR (common language runtime), 6
CIL (common intermediate language), 7
memory management, automatic, 8-9
VES (virtual execution system), 7-8
DLR (dynamic language runtime), 11-13
FCL (framework class library), 9
BCL (Base Class Libraries), 9
parallel computing platform, 11
reflection, 447
Windows Runtime compared, 404-405
New Project dialog box (WPF), 373
NewGuid method, 56
next statement, setting, 42-43
nodes, children, 339
nongeneric collections, 211-214
not equals (!=) operator, 62
Not (!) operator, 64
Now property, 55
null types, 66
null-coalescing operators, 66-69
sample application, 69
null-coalescing (??) operator, 61, 66-68
NullReferenceException, 240
object initializers, 104
object lifetime, 467
object model, creating, 353
object-oriented programming, 78
objects minimum value, finding, 262
Obsolete attributes, 443
OneTime data binding, 386
OneWay data binding, 386, 431-432
OneWayToSource data binding, 386
OpenRead method
File class, 313
FileInfo class, 308
OpenText method
File class, 313
FileInfo class, 308
OpenWrite method
File class, 313
FileInfo class, 308
additive, 61
addition (+), 60
decrement (--), 62
division (/), 60
increment (++), 62
multiplication (*), 60
sample application, 63
subtraction (-), 60
compound, 60
sample application, 63
cast, 71
conditional AND, 61
conditional OR, 61
equality, 61
lambda, 61
logical, 64
And (conditional) (&&), 64
And (logical) (&), 64
Not (!), 64
Or (conditional) (||), 64
Or (exclusive) (^), 64
Or (logical) (|), 64
sample application, 64
short-circuit evaluation, 64
truth table, 64
logical AND, 61
logical OR, 61
logical XOR, 61
multiplicative, 61
null-coalescing (??), 61, 66-68
overloading, 137
language interoperability, 137
listing of, 137
symmetrical groups, 137
primary, 61
relational, 62
equals (==), 62
greater than (>), 62
greater than or equals (>=), 62
less than (<), 62
less than or equals (<=), 62
not equals (!=), 62
sample application, 64
relational and type testing, 61
sample application, 64
shift, 61
unary, 61
Or (conditional) (||) operator, 64
Or (exclusive) (^) operator, 64
Or (logical) (|) operator, 64
order of arguments, 95
OrderablePartitioner<TSource> class, 484
OutOfMemoryException, 240
output parameters, 90
Overlaps method
HashSet<T> class, 219
SortedSet<T> class, 219
overloading
constructors, 98
operators, 137
language interoperability, 137
listing of, 137
symmetrical groups, 137
overriding base class members, 116-118
PadLeft method, 187
PadRight method, 187
Page event handlers, 422
Page_Load method, 422
Page_LoadComplete method, 422
Page_PreInit method, 422
Page_PreLoad method, 422
Page_PreRender method, 422
Page_PreRenderComplete method, 422
Page_Unload method, 422
parallel computing platform, 11
Parallel LINQ (PLINQ), 487-488
ParallelEnumerable operators, 487
parallelism
concurrent collections, 484
thread-safe collections, 483-484
waiting on tasks, 486
param target, 439
parameters, 90
attributes, 439
methods, 90
named, 439
output, 90
positional, 439
reference, 90
required, 94
value, 90
Parent method, 306
Parse method, 56
Partitioner class, 484
Partitioner<TSource> class, 484
Pascal casing notation, 19
Password property, 58
Path class, 304
paths, 304
absolute, 304
Path class, 304
relative, 304
PDC (Microsoft’s Professional Developer Conference), 1
Peek method
Queue<T> class, 227
Stack<T> class, 224
Personal folder, 305
PLINQ (Parallel LINQ), 487-488
pointers, 50
sample application, 115
Pop method, 224
PopulatePicturesGrid method, 414-415
Port property, 58
porting a desktop application to Windows Store apps, 414
positional arguments, 95
positional parameters, 439
post-events, 154
preconditions, 255
bool, 51
byte, 51
char, 51
CLS-compliance and, 53
double, 51
dynamic, 52
float, 51
GUIDs (globally unique identifiers), 56
reference, 15
string, 51
using, 54
value, 15
var, 53
void, 52
preemptive multitasking, 476
pre-events, 154
prerequisites for databases, 343-345
Primary Interop Assembly (PIA), 459-460
primary operator, 61
primitives, 481
private access, 83
procedural programming, 147
automatic, 86
read-only, 87
sample application, 89
structures, 143
write-only, 87
Properties window (WPF), 375
property target, 439
protected access, 83
protected internal access, 83
public access, 83
public fields, 143
publishing events, 152-154, 157
pure methods, 258
Push method, 224
queries
DOM (Document Object Model) XML, 335
LINQ to DataSet, 352
LINQ to Entities, 361
LINQ to SQL, 354
XML (Extensible Markup Language), 333-337
query expressions (LINQ), 284-285
anonymous type, returning, 286
deferred execution, 301
filtering data, 287
delegate replacement, 297-298, 300
variables, capturing, 298
lazy evaluation, 301
standard query operator methods, 296-297
syntax, 285
Query property, 58
Queue<T> class, 226
RangeValidator control, 433
Read method, 315
ReadAllLines method, 313, 320-321
ReadAllText method, 313
reader threads, 481
reader-writer locks, 481
reading and writing data, 314-321
read-only database access, 348
read-only properties, 87
ReadOnlyCollection<T>, 219
reference parameters, 90
reference types, 14-15, 50, 465
predefined reference types, 15
reflection, 447
reflection interoperability, 461-462
Refresh method
DirectoryInfo class, 306
FileInfo class, 308
Regex class, 200
regular expressions, 199
compatibility, 199
substrings, matching, 201
validation with, 201
RegularExpressionValidator control, 433
relational and type testing operator, 61
relational operators, 62
equals (==), 62
greater than (>), 62
greater than or equals (>=), 62
less than (<), 62
less than or equals (<=), 62
not equals (!=), 62
sample application, 64
relative paths, 304
Remove method, 187
Dictionary<TKey, TValue> class, 220
HashSet<T> class, 219
SortedDictionary<TKey, TValue> class, 221
SortedList<TKey, TValue> class, 221
SortedSet<T> class, 219
RemoveItem method, 218
RemoveWhere method
HashSet<T> class, 219
SortedSet<T> class, 219
Replace method, 187
File class, 313
FileInfo class, 308
ReplaceWith method, 339
replacing data, 339
required parameters, 94
required references
ADO.NET, 348
LINQ to DataSet, 352
RequiredFieldValidator control, 433
Resize method, 210
resource dictionaries, 381-382
rethrowing exceptions, 250-251
return codes used to report errors, 237
return statement, 175
return target, 439
Reverse method
HashSet<T> class, 219
SortedSet<T> class, 219
Root method, 306
routed events, 368
rows/columns
creating, 376
definitions for, 377
star sizing, 378
running applications, 32
runtime
accessing attributes at, 447-448
determining dynamic types at, 454
RuntimeWrappedException, 238
safety, threads, 477
Scheme property, 58
sealing classes, 120
Seconds method, 57
SEHException, 240
selecting data
with LINQ to SQL, 354
with XML (Extensible Markup Language), 333-337
selection statements, 159
cascaded, 161
“mismatched else” problem, 161
nested, 160
sample application, 161
syntax, 160
fall through, 164
sample application, 164
scope, 164
syntax, 162
semaphore, 481
server-side validation, 432-433
Session_End method, 423
Session_Start method, 423
SetAttributes method, 313
SetAttributeValue class, 330-331
SetElementValue class, 330-331
SetEquals method
HashSet<T> class, 219
SortedSet<T> class, 219
SetItem method, 218
shift operator, 61
short-circuit evaluation, 64
sideloading, 407
signals, 480
signatures, 91
Snap view (Windows Store apps), 405
Solution Explorer, 28
Sort method
List<T> collection, 215
System.Array class, 210
SortDescription structure, 389
SortedDictionary<TKey, TValue> class, 219-221
SortedList<TKey, TValue> class, 219-221
SortedSet<T> class, 219
source files for this book, 4
special directories, 305
specialization, 110
Spinlock class, 480
Split method, 188
SQL injection attacks, 349
SQL Server, 343
SQL Server Express, 343
StackOverflowException, 240
StackPanel (WPF layout), 370
stacks, 224
Stack<T> class, 224
standard exceptions, 239
standard format strings, 192-193
ToString method, overriding, 191
standard query operator methods, 296-297
Start Page, 26
StartsWith method, 186
starvation, threads, 477
statements, 15
adding, 31
iteration, 165
break statement, 172
continue statement, 174
return statement, 175
next statement, setting, 42-43
selection, 159
whitespace, 15
streams, 303
closing, 309
StreamWriter class, 318
string type, 51
strings, 180
case, changing, 186
CompareOrdinal method, 185
CompareTo method, 185
Contains method, 185
EndsWith method, 186
rules for, 185
sample application, 186
StartsWith method, 186
composite formatting, 198
concatenation, 188
custom format strings, 195
interning, 180
character escape sequences, 181
verbatim, 181
naming conventions, 179
regular expressions, 199
compatibility, 199
substrings, matching, 201
validation with, 201
standard format, 192
ToString method, overriding, 191
regular expressions used for matching, 201
ToString method, 182
type formatting, 191
structs, 272
structures, 136
initializing, 139
operator overloading, 137
language interoperability, 137
listing of, 137
symmetrical groups, 137
properties, 143
public fields, 143
regular expressions used for matching, 201
Subtract method, 57
subtraction (-) operator, 60
swallowing exceptions, 244
fall through, 164
sample application, 164
scope, 164
syntax, 162
switching call stack frames, 42
symmetrical groups for operator overloading, 137
SymmetricExceptWith method
HashSet<T> class, 219
SortedSet<T> class, 219
synchronization, 477
interlocked operations, 480
mutex, 481
primitives, 481
reader-writer locks, 481
semaphore, 481
signals, 480
syntax for query expressions (LINQ), 285
System folder, 305
System namespace, 12
System.Collections.Generic namespace, 12
System.Data namespace, 12
System.Diagnostics namespace, 12
System.Environment.FailFast, 241
System.Globalization namespace, 12
System.IO namespace, 12
System.Linq namespace, 12
System.Net namespace, 12
System.Security namespace, 12
System.ServiceModel namespace, 12
System.Text namespace, 12
System.Web namespace, 12
System.Windows namespace, 12
System.Windows.Controls namespace, 12
System.Windows.Forms namespace, 12
System.Xml namespace, 12
targets
attributes, 439
data binding, 386
Task Parallel Library (TPL), 481
concurrent collections, 484
thread-safe collections, 483-484
PLINQ (Parallel LINQ), 487-488
waiting on tasks, 486
associating, 400
defining, 399
text
StreamWriter class, 318
WPF, 372
Text property, 434
threads, 476
asynchrony, 408
concurrency issues, 477
deadlock, 477
disadvantages of, 476
multiple, 476
preemptive multitasking, 476
reader, 481
safety, 477
starvation, 477
synchronization, 477
writer, 481
thread-safe collections, 483-484
throw keyword, 239
TimeOfDay property, 55
Today property, 55
ToString method, 182
TotalDays method, 57
TotalHours method, 57
TotalMilliseconds method, 57
TotalMinutes method, 57
TotalSeconds method, 57
TPL. See Task Parallel Library (TPL)
tracepoints, 40
Trim method, 187
TrimEnd method, 187
TrimExcess method
HashSet<T> class, 219
List<T> collection, 215
Queue<T> class, 227
SortedDictionary<TKey, TValue> class, 221
SortedList<TKey, TValue> class, 221
SortedSet<T> class, 219
Stack<T> class, 224
TrimStart method, 187
TrueForAll method
List<T> collection, 215
System.Array class, 210
truth table, 64
try keyword, 242
TryCreate method, 58
TryGetValue method
SortedDictionary<TKey, TValue> class, 221
SortedList<TKey, TValue> class, 221
TryParse method, 56
tunneling strategy to route events, 368
TwoWay data binding, 386, 431-432
type inference used for calling generic methods, 270
generics, 265
hiding, 269
type target, 439
BigInteger, 59
sample application, 72
arithmetic methods, 55
properties, 55
default values, 66
disposable, 468
defining, 130
multiple named values, 131
sample application, 133
underlying type, 132
zero value, 132
formatting, 191
IDisposable interface, 467-469
null, 66
null-coalescing (??) operator, 66-69
sample application, 69
pointers, 50
bool, 51
byte, 51
char, 51
CLS-compliance and, 53
double, 51
dynamic, 52
float, 51
GUIDs (globally unique identifiers), 56
string, 51
using, 54
var, 53
void, 52
predefined, 15
structures, 136
classes compared, 136
declaring, 136
unified type system, 51
Uri class, 58
using, 54
predefined, 15
typography (WPF), 372
unary operator, 61
underlying type, 132
unified type system, 51
UnionWith method
HashSet<T> class, 219
SortedSet<T> class, 219
unit tests, 46
unsubscribing, events, 150-152
updating records, 357
Uri class, 58
Uri property, 58
Uri class, 58
user interface considerations, 413
UserName property, 58
UtcNow property, 55
ValidatesOnDataErrors property, 397
ValidatesOnException property, 397
arguments, 239
client-side validation
CompareValidator control, 433
CustomValidator control, 433
RangeValidator control, 433
RegularExpressionValidator control, 433
RequiredFieldValidator control, 433
ControlToValidate property, 434
Display property, 434
ErrorMessage property, 434
with regular expressions, 201
Text property, 434
client-side validation, 433-435
server-side validation, 432-433
ValidationRules property, 396-397
value equity, testing for, 267-268
value parameters, 90
predefined, 15
Values method, 220
var type, 53
capturing with lambdas, 298
declaration space, 16
lifetime, 16
scope, 16
variant generic interfaces, 274-278
verbatim literal strings, 181
VES (virtual execution system), 7-8
execution of program, controlling, 40-43
Immediate window, 38
tracepoints, 40
unit tests, 46
editions, 26
items, 28
running applications, 32
Solution Explorer, 28
Start Page, 26
statements
adding, 31
next statement, setting, 42-43
writing your first program, 28-32
void type, 52
Wait method, 479
waiting on tasks, 486
Web applications, 420
browser communication, 420
adding binding expressions, 431
Bind method, 432
client-side validation, 433-435
server-side validation, 432-433
Global.asax event handlers, 423
inline styles, 430
layout
Page event handlers, 422
Web Forms, 420
sample application, 166
for statement compared, 169
syntax, 165
whitespace, 15
Wiltamuth, Scott, 1
Windows folder, 305
naming conventions, 411
sample application, 410
threads and, 408
.NET Framework compared, 404-405
enterprise access to, 407
porting a desktop application to, 414-417
Snap view, 405
user interface considerations, 413
WPF (Windows Presentation Foundation), 149, 366
advantages of, 366
animation, 372
application creation
Collection Editor, 377
document outline, 375
New Project dialog box, 373
Properties window, 375
rows/columns, creating, 376
rows/colums, definitions for, 377
rows/colums, star sizing, 378
Visual Studio, 372
XAML designer, 374
App.xaml file, 381
collections, implementing, 390
components, 386
current item pointers, 392
OneTime, 386
OneWay, 386
OneWayToSource, 386
SortDescription structure, 389
target, 386
TwoWay, 386
ConverterParameter property, 396
multivalue converters, 394-396
associating, 400
defining, 399
documents, 372
graphics, 371
Canvas, 370
default layout controls, 370
Grid, 370
resource dictionaries, 381-382
StackPanel, 370
WrapPanel, 370
media, 372
routed events, 368
text, 372
typography, 372
Windows Runtime, 378
WrapPanel (WPF layout), 370
wrapping exceptions, 251
Write method, 315
WriteAllBytes method, 313, 320
WriteAllLines method, 313, 320-321
WriteAllText method, 313
write-only properties, 87
writer threads, 481
writing and reading data, 314-321
writing your first program, 28-32
XAML (Extensible Application Markup Language), 366-367
browser applications, 369
CollectionViewSource class, 388
photo viewer application layout, 379-380
x:Class attribute, 367
x:Name attribute, 380
XAML designer, 374
XBAPs (XAML browser applications), 369
x:Class attribute, 367
XDocument class, 327
XML (Extensible Markup Language), 325
adding data, 340
creating XML with
DOM (Document Object Model) XML, 328-329
LINQ to XML, 328
DOM (Document Object Model), 326-327
queries, 335
encoding and decoding characters, 329
LINQ to XML, 327
creating XML with, 328
SetAttributeValue class, 330-331
SetElementValue class, 330-331
XDocument class, 327
namespaces, 331
atomization, 333
sample application, 334
replacing data, 339
x:Name attribute, 380
XPathEvaluate method, 335
XPathSelectElement method, 336
XPathSelectElements method, 336
XPS (XML Paper Specification) documents, 372
Year property, 55
zero value, 132
3.142.133.180