Index

Symbols

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

A

absolute paths, 304

AbsoluteUri method, 58

abstract classes, 120-121

abstraction, 78-79

access modifiers, 81-83

accessibility, 81-83

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

queries, 348-349

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

browser-hosted, 369, 420

Web applications, 420

ASP.NET, 420-423

browser communication, 420

creating, 423-432

CSS files, 429-430

data binding, 431-432

data validation, 432-435

Global.asax event handlers, 423

inline styles, 430

layout, creating, 426-428

layout, styling, 429-430

master pages, 426-427

Page event handlers, 422

Windows Store apps, 405-408

app bar, 406-407

building, 412-417

charms, 406-407

enterprise access to, 407

layout, creating, 413-417

new controls, 406-407

porting a desktop application to, 414-417

Snap view, 405

user interface considerations, 413

WPF used to create, 368-369

Collection Editor, 377

document outline, 375

layout, creating, 376-380

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

XAML, 368-369

Application_Start method, 423

App.xaml file, 381

ArgumentException, 240

ArgumentOutOfRangeException, 240

arguments

order of, 95

positional, 95

arithmetic operators, 60-63

addition (+), 60

decrement (--), 62

division (/), 60

increment (++), 62

multiplication (*), 60

sample application, 63

subtraction (-), 60

arrays, 205-207

declaring, 206

generics combined with, 273-274

indexing, 208

initialization, 208-210

jagged, 207

multidimensional, 207

single-dimensional, 207

size of, 206

System.Array class, 210

AsOrdered ( ) operator, 487

AsParallel ( ) operator, 487

ASP.NET, 420-423

ASPX files, 420-421

data binding, 431-432

embedded ASP.NET code blocks, 432

Model View Controller (MVC) Framework, 420

Web applications, 420-423

Web Forms, 420

ASPX files, 420-421

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

async method, 410-412

asynchrony, 408-412

naming conventions, 411

sample application, 410

threads and, 408

atomization, 333

attributes, 437-440

accessing, 447-448

assembly manifest, 445

Caller Info attributes, 440-442

common attributes

Conditional, 443-444

Obsolete, 443

custom, 446-447

retrieving, 447

global, 444-445

multiple attributes, accessing, 448

naming conventions, 438

parameters, 439

runtime, accessing attributes at, 447-448

targets, 439

Attributes method, 308

automatic properties, 86

B

BCL (Base Class Libraries), 9

BigInteger type, 59

binary files, 314-318

BinarySearch method

List<T> collection, 215

System.Array class, 210

Bind method, 432

BlockingCollection<T> class, 484

bool type, 51

Boolean values, 52

boxing conversion, 70-71

break statement, 172

breakpoints, 39-40

browser-hosted applications, 369, 420

bubbling strategy to route events, 368

buffered streams, 303, 316-318

BufferedStream class, 316

byte type, 51

C

C#, 1, 13-14

expressions, 15

identifiers, 18-19

keywords, 19-20

statements, 15

types, 14-15

variables, 15-17

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

chaining constructors, 99-100

ChangeExtension method, 304

char type, 51

character escape sequences, 181

charms, 406-407

children nodes, 339

CIL (Common Intermediate Language), 7, 265

classes, 79

abstract, 120-121

access modifiers, 81-83

accessibility, 81-83

internal access, 83

private access, 83

protected access, 83

protected internal access, 83

public access, 83

constants, 83-84

declaration space, 79-82

downcasting, 112-114

fields, 83-85

generics, 271

creating, 271

inheritance, 272-273

interfaces compared, 272

structs compared, 272

instantiating, 96-101

methods, 88

declaring, 88-90

as input, 91

named arguments, 95

optional parameters, 92-95

overloading, 91-92

parameters, 90

sample application, 93

signatures, 91

nested, 101

object initializers, 104

partial, 101-102

properties, 84-89

automatic, 86

declaring, 84-86

read-only, 87

sample application, 89

write-only, 87

regular expressions, 199-201

scope, 79-82

static, 102-103

structures compared, 136, 142-143

upcasting, 112-114

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

CTS (common type system), 6-7

garbage collection, 8-9

memory management, automatic, 8-9

VES (virtual execution system), 7-8

CLS-compliance and type, 53

CLSCompliant attribute, 445

code contracts, 254-255

code-behind, 367-369

Collection Editor, 377

collection views, 388-390

collections, 205

arrays, 205-207

declaring, 206

indexing, 208

initialization, 208-210

jagged, 207

multidimensional, 207

single-dimensional, 207

size of, 206

System.Array class, 210

Collection<T>, 214

sample application, 214

virtual methods, 217-218

dictionaries, 219-222

sample application, 222

sorting, 219-221

generic, 211-214

implementing, 390

initializers, 226-229

interfaces, 229-230

LinkedList<T>, 214

List<T>, 214-216

nongeneric, 211-214

queues, 224, 226

ReadOnlyCollection<T>, 219

sets, 219-225

stacks, 224

Collection<T>, 214

sample application, 214

virtual methods, 217-218

CollectionViewSource class, 388

columns/rows

creating, 376

definitions for, 377

star sizing, 378

COM interoperability, 459-461

Combine method, 304

COMException, 240

comments (code), 44

delimited, 45

multiline, 45

writing, 45-46

XML, 44-45

common attributes

Conditional, 443-444

Obsolete, 443

Common Intermediate Language (CIL), 7, 265

common language runtime. See CLR (common language runtime)

common type system (CTS), 6-7

CommonApplicationData folder, 305

CommonDocuments folder, 305

Compare method, 58

CompareOrdinal method, 185

CompareTo method, 56, 185

CompareValidator control, 433

compatibility, regular expressions, 199

compiler errors, 33-34

Complex type, 59-60

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

data parallelism, 482-484

PLINQ (Parallel LINQ), 487-488

task parallelism, 484-487

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

constants, 83-84

constraints, 265-268

constructors

chaining, 99-100, 117

declaring, 97-98

default, 97, 114

inheritance

chaining constructors, 117

default constructors, 114

in derived classes, 116

overloading, 98

static, 100-101

structures, 139-142

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

contextual keywords, 19-20

continue statement, 174

Contract.Result<T> class, 256-257

controls

CompareValidator control, 433

CustomValidator control, 433

data validation, 433-435

RangeValidator control, 433

RegularExpressionValidator control, 433

RequiredFieldValidator control, 433

ControlToValidate property, 434

conversion, 68-70

boxing, 70-71

dynamic types, 454

implicit, 68-70

operators, 138-141

sample application, 72

unboxing, 70-71

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

CTS (common type system), 6-7

current item pointers for data binding, 392

custom attributes, 446-447

retrieving, 447

custom dynamic objects

creating, 458

using, 458-459

custom dynamic types, 459

custom format strings, 195

specifiers, 195-197

CustomValidator control, 433

D

data binding, 385-387

adding binding expressions, 431

ASP.NET, 431-432

Bind method, 432

collection view, 388-390

collections, implementing, 390

components, 386

creating, 387-392

current item pointers, 392

Eval method, 431-432

OneTime, 386

OneWay, 386, 431-432

OneWayToSource, 386

SortDescription structure, 389

target, 386

TwoWay, 386, 431-432

Web applications, 431-432

WPF, 372

data conversion, 392-393

ConverterParameter property, 396

creating converters, 392-393

multivalue converters, 394-396

data hiding, 78-79

data parallelism, 482-484

concurrent collections, 484

guidelines, 488-489

thread-safe collections, 483-484

data providers, 347

data selection, 285-288

data streams. See streams

data templates, 399-400

associating, 400

defining, 399

data validation, 396-399

client-side validation

CompareValidator control, 433

CustomValidator control, 433

RangeValidator control, 433

RegularExpressionValidator control, 433

RequiredFieldValidator control, 433

controls, 433-435

ControlToValidate property, 434

Display property, 434

ErrorMessage property, 434

Text property, 434

Web applications, 432-435

client-side validation, 433-435

sample application, 433-435

security, 432-433

server-side validation, 432-433

databases, 343

ADO.NET, 346

connection pooling, 349

data providers, 347

DataSet class, 346

queries, 348-349

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

LINQ to DataSet, 351-352

LINQ to Entities, 359-361

LINQ to SQL, 353-359

prerequisites for, 343-345

DataContext class, customizing, 358-359

DataSet class, 346

DataTips, 37-38

Date property, 55

DateTime type, 55-56

arithmetic methods, 55

properties, 55

Day property, 55

DayOfWeek property, 55

Days method, 57

deadlocks, 477

debugging code, 32-33

breakpoint, 39-40

compiler errors, 33-34

DataTips, 37-38

Exception Assistant, 34-35

exception point, 34-35

execution of program, controlling, 40-43

Immediate window, 38

runtime errors, 33-34

tracepoints, 40

unit tests, 46

variable windows, 36-37

visualizers, 43-44

decimal type, 51-53

declaration space, 16, 79-82

declaring

catch handler, 243

constructors, 97-98

events, 152-154

indexers, 211

interfaces, 122

methods, 88-90

properties, 84-86

structures, 136

decoding and encoding characters in XML (Extensible Markup Language), 329

decrement (--) operator, 62

default constructors, 97

default layout controls (WPF layout), 370

default values, 66, 268-269

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

deleting records, 357-358

delimited comments, 45

DependencyObject, 386

Dequeue method, 227

derivation. See inheritance

Design by Contract, 254-255

designing class hierarchies, 112

desktop applications

Collection Editor, 377

document outline, 375

layout, creating, 376-380

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

dictionaries, 219-222

sample application, 222

sorting, 219-221

Dictionary<TKey, TValue> class, 219-220

direct strategy to route events, 368

directories

Directory class, 311-312

DirectoryInfo class, 306-307, 310

File class, 312

FileInfo class, 306-310

paths, 304

special, 305

Directory class, 311-312

Directory method, 308

DirectoryInfo class, 306-307, 310

DirectoryName method, 308

Display property, 434

disposable types, 468

dispose pattern, 469-470

division (/) operator, 60

DLR (dynamic language runtime), 11-13, 451, 456-457

COM interoperability, 459-461

custom dynamic objects

creating, 458

using, 458-459

ExpandObject class, 457

IDynamicMetaObjectProvider interface, 457

do statement, 166-167

sample application, 167

syntax, 167

DockPanel (WPF layout), 370-371

document outline, 375

documents in WPF, 372

DOM (Document Object Model) XML, 326-327

creating XML with, 328-329

queries, 335

double type, 51

downcasting, 112-114

downloading

SQL Server, 343

SQL Server Express, 343

dynamic language runtime. See DLR (dynamic language runtime)

dynamic languages, 13

dynamic types, 52, 451-452

COM interoperability, 459-461

conversions, 454

creating, 459

custom, 459

overload resolution, 455-456

reflection interoperability, 461-462

runtime, determining dynamic types at, 454

sample application, 453-452

E

editions, 26

Eiffel programming language, 254-255

embedded ASP.NET code blocks, 432

Empty method, 56

empty strings, 182-183

encapsulation, 78-79

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

enumerable objects, 230-233

EnumerateDirectories method

Directory class, 311

DirectoryInfo class, 306

EnumerateFiles method

Directory class, 311

DirectoryInfo class, 306

EnumerateFileSystemEntries method, 311

EnumerateFileSystemInfos method, 306

enumerations, 129-132

defining, 130

flags, 132-135

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

compiler, 33-34

return codes used to report, 237

runtime, 33-34

EscapeUriString method, 58

Eval method, 431-432

event handlers, 148-151

event target, 439

event-driven programming, 147. See also events

events, 147-148

bubbling strategy to route events, 368

declaring, 152-154

delegates, 148

direct strategy to route events, 368

firing, 154-157

handlers

attaching to events, 148-151

multithreaded, 156

post-events, 154

pre-events, 154

publishing, 152-154, 157

raising, 154-157

routed, 368

subscribing, 148-151

tunneling strategy to route events, 368

unsubscribing, 150-152

Exception Assistant, 34-35

exception points, 34-35

exceptions, 238. See also specific exceptions

code contracts, 254-255

Contract.Result<T> class, 256-257

corrupted state, 250

guard statements, 253-254

handling, 242-240

catch handler, 242-244

finally handler, 242

task parallelism, 486-487

integer arithmetic operations, overflowing, 252-253

invariants, 257-258

multiple, catching, 244

overflow, 252-253

checked context, 252-253

unchecked context, 252-253

postconditions, 256-257

preconditions, 255

pure methods, 258

rethrowing, 250-251

RuntimeWrappedException, 238

sample application, 245-249

standard, 239

swallowing, 244

System.Exception, 238-239

throwing, 239-241

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

lambdas, 298-299

Extensible Application Markup Language (XAML), 366-367

applications, 368-369

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

F

fall through switch statement, 164

FCL (framework class library), 9

fields, 83-85

sample application, 85

target, 439

File class, 312

FileInfo class, 306, 307-310

files, 303

binary, 314-318

Directory class, 311-312

DirectoryInfo class, 306-307, 310

File class, 312

reading and writing data using, 320-321

FileInfo class, 306-310

paths, 304

absolute, 304

Path class, 304

relative, 304

reading and writing data, 314-321

StreamWriter class, 318

text, 318

FileStream class, 314-318

filtering data, 287

Find method

List<T> collection, 215

System.Array class, 210

FindAll method

List<T> collection, 215

System.Array class, 210

firing events, 154-157

flag enumerations, 132-135

flattening data, 294-296

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

ForEach method

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

G

garbage collection, 8-9, 466-467

dispose pattern, 469-470

finalizers, 470-472

IDisposable interface, 467-469

using statement, 468-469

generics

arrays combined with, 273-274

C++ templates compared, 265

classes, 271

creating, 271

inheritance, 272-273

interfaces compared, 272

structs compared, 272

collections, 211-214

interfaces, variance in, 274-278

Java generics compared, 265

methods, 269

calling, 269-270

in nongeneric classes, 269

type inference used for calling, 270

type parameters, hiding, 269

minimum value, finding, 263-266

tuples, 278

type parameters, 265

constraints, 265-268

default values, 268-269

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 attributes, 444-445

Global.asax event handlers, 423

Golde, Peter, 1

goto statement, 171-172

graphics, 371

greater than (>) operator, 62

greater than or equals (>=) operator, 62

Grid (WPF layout), 370

GridView.Tapped event handler, 415

Group class, 201

group clause, 290-291

grouping data, 289-292

guard statements, 253-254

GUIDs (globally unique identifiers), 56

H

handling exceptions, 242-240

catch handler, 242-244

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

I

IBindingList view, 389

ICollection<T> interface, 229

IComparer<T> interface, 229

identifiers, 18-19

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

if statements, 160-161

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

sample application, 212-213

syntax, 211

IndexOf method, 219

IndexOutOfRangeException, 240

infinite loops, 168

inheritance, 109-111

constructors

chaining, 117

default, 114

in derived classes, 116

designing class hierarchies, 112

generic classes, 272-273

hiding base class members, 119-120

implementation, 111-112

multiple, 110

overriding base class members, 116-118

polymorphism, 110-111

sample application, 115

sample application, 115

sealing classes, 120

initializer declaration space, 168

initializers, 226-229

initializing structures, 139

inline styles for Web applications, 430

input, methods as, 91

InsertItem method, 218

instantiating classes, 96-101

int type, 51, 53

integer arithmetic operations, overflowing, 252-253

interfaces, 122-123, 229-230

declaring, 122

explicit interface implementation, 125-126

extension methods, 123

generic, 274-278

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

invariants, 257-258

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

do statement, 166-167

sample application, 167

syntax, 167

foreach statement, 170-171

iteration variable, 170

sample application, 171

syntax, 170

for statement, 168-169

infinite loops, 168

initializer declaration space, 168

sample application, 169

syntax, 168

while statement compared, 169

while statement, 165-166

sample application, 166

for statement compared, 169

syntax, 165

iteration variable, 170

iterators, 230-233

J

Java generics, 265

JIT (Just-In-Time) compiler, 8, 265

Join method, 188

joining

data, 291-294

strings, 188-189

jump statements, 171-172

break statement, 172

continue statement, 174

goto statement, 171-172

return statement, 175

K

Keys method, 220

keywords, 19

contextual, 19

list of, 19

L

lambda operator, 61

lambdas, 297-300

delegate replacement, 297-298, 300

expression, 298-299

statement, 299-300

variables, capturing, 298

language interoperability, 137

layouts

creating

Web applications, 426-428

Windows Store apps, 413-417

styling, 429-430

WPF, 370-371

Canvas, 370

creating, 376-380

default layout controls, 370

DockPanel, 370-371

Grid, 370

resource dictionaries, 381-382

StackPanel, 370

styling, 381-382

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

concatenating data, 285-286

data selection, 285-288

deferred execution, 301

filtering data, 287

flattening data, 294-296

group clause, 290-291

grouping data, 289-292

joining data, 291-294

lambdas, 297-300

lazy evaluation, 301

orderby clause, 289-290

ordering data, 289-292

query expressions, 284-285

standard query operator methods, 296-297

syntax, 285

LINQ to ADO.NET, 351

LINQ to DataSet, 351-352

queries, 352

required references, 352

LINQ to Entities, 359-361

EntityClient data provider, 360

queries, 361

LINQ to SQL, 353-359

adding new records, 357

DataContext class, customizing, 358-359

deleting records, 357-358

namespaces, required, 354

object model, creating, 353

queries, 354

sample application, 355-356

selecting data, 354

updating records, 357

LINQ to DataSet, 351

queries, 352

required references, 352

LINQ to Entities, 359-360

EntityClient data provider, 360

queries, 361

LINQ to SQL, 353

adding new records, 357

DataContext class, customizing, 358-359

deleting records, 357-358

namespaces, required, 354

object model, creating, 353

queries, 354

sample application, 355-356

selecting data, 354

updating records, 357

LINQ to XML, 327

creating XML with, 328

namespaces, 331-334

queries, 335-336

SetAttributeValue class, 330-331

SetElementValue class, 330-331

XAttribute class, 328-331

XDocument class, 327

XElement class, 328-331

XName class, 331-334

XNamespace class, 331-334

List<T>, 214-216

literals

strings, 180-181

character escape sequences, 181

verbatim, 181

values, 17-18

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

long type, 51, 53

M

magic numbers, 17-18

MakeRelativeUri, 58

manipulation of strings, 183-189

markup, 366-367

master pages for Web applications, 426-427

Match class, 200

MatchCollection class, 200

Max method, 219

media, 372

memory organization, 465-466

automatic, 8-9

garbage collection, 466-467

dispose pattern, 469-470

finalizers, 470-472

IDisposable interface, 467-469

using statement, 468-469

heap memory, 465-466

stack memory, 465-466

metacharacters, 199-200

methods, 88

anonymous, 152

declaring, 88-90

extension, 102-103

generics, 269

calling, 269-270

in nongeneric classes, 269

type inference used for calling, 270

type parameters, hiding, 269

as input, 91

named arguments, 95

optional parameters, 92-95

overloading, 91-92

parameters, 90

output, 90

reference, 90

required, 94

value, 90

sample application, 93

signatures, 91

structures, 136-141

target, 439

Microsoft’s Professional Developer Conference (PDC), 1

Milliseconds method, 57

Min method, 219

minimum value, finding, 262

with generics, 263-266

with objects, 262

without generics, 262-264

Minute property, 55

Minutes method, 57

“mismatched else” problem, 161

Model View Controller (MVC) Framework, 420

modifiers, 211

modifying

strings, 187-188

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

mutable strings, 189-190

mutex, 481

MVC (Model View Controller) Framework, 420

MyDocuments folder, 305

N

Name method

DirectoryInfo class, 306

FileInfo class, 308

named arguments, 95

namespaces, 10-12

LINQ to SQL, 354

LINQ to XML, 331-334

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

creating XML with, 331-333

sample application, 334

naming conventions

asynchrony, 411

attributes, 438

strings, 179

nested classes, 101

nested if statement, 160

.NET Framework, 1, 5-6

CLR (common language runtime), 6

CIL (common intermediate language), 7

CTS (common type system), 6-7

garbage collection, 8-9

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

namespaces, 10-12

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

nullable types, 66-69

null-coalescing operators, 66-69

sample application, 69

null-coalescing (??) operator, 61, 66-68

NullReferenceException, 240

O

object initializers, 104

object lifetime, 467

object model, creating, 353

object type, 51-52

object-oriented programming, 78

abstraction, 78-79

encapsulation, 78-79

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

operators, 60-61

additive, 61

arithmetic, 60-63

addition (+), 60

decrement (--), 62

division (/), 60

increment (++), 62

multiplication (*), 60

sample application, 63

subtraction (-), 60

assignment (=), 60-63

compound, 60

sample application, 63

cast, 71

conditional, 61, 65-66

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

conversion operators, 138-141

language interoperability, 137

listing of, 137

sample application, 140-141

symmetrical groups, 137

precedence, 60-61

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

optional parameters, 92-95

Or (conditional) (||) operator, 64

Or (exclusive) (^) operator, 64

Or (logical) (|) operator, 64

order of arguments, 95

OrderablePartitioner<TSource> class, 484

orderby clause, 289-290

ordering data, 289-292

OutOfMemoryException, 240

output parameters, 90

overflow, 252-253

checked context, 252-253

unchecked context, 252-253

Overlaps method

HashSet<T> class, 219

SortedSet<T> class, 219

overload resolution, 455-456

overloading

constructors, 98

methods, 91-92

operators, 137

conversion operators, 138-141

language interoperability, 137

listing of, 137

sample application, 140-141

symmetrical groups, 137

overriding base class members, 116-118

P

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

data, 482-484

concurrent collections, 484

guidelines, 488-489

thread-safe collections, 483-484

task, 484-487

exceptions, handling, 486-487

guidelines, 488-489

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

partial classes, 101-102

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

polymorphism, 110-111

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

postconditions, 256-257

post-events, 154

precedence, operator, 60-61

preconditions, 255

predefined types, 51-54

bool, 51

byte, 51

char, 51

CLS-compliance and, 53

decimal, 51, 52, 53

double, 51

dynamic, 52

float, 51

GUIDs (globally unique identifiers), 56

implicit conversions, 68-70

int, 51, 53

long, 51, 53

object, 51-52

reference, 15

sbyte, 51, 53

short, 51, 53

string, 51

uint, 51, 53

ulong, 51, 53

ushort, 51, 53

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

properties, 84-89

automatic, 86

declaring, 84-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

Q

queries

ADO.NET, 348-349

DOM (Document Object Model) XML, 335

LINQ to DataSet, 352

LINQ to Entities, 361

LINQ to SQL, 354

LINQ to XML, 335-336

XML (Extensible Markup Language), 333-337

query expressions (LINQ), 284-285

anonymous type, returning, 286

concatenating data, 285-286

data selection, 285-288

deferred execution, 301

filtering data, 287

flattening data, 294-296

group clause, 290-291

grouping data, 289-292

joining data, 291-294

lambdas, 297-300

delegate replacement, 297-298, 300

expression, 298-299

statement, 299-300

variables, capturing, 298

lazy evaluation, 301

orderby clause, 289-290

ordering data, 289-292

standard query operator methods, 296-297

syntax, 285

Query property, 58

queues, 224, 226

Queue<T> class, 226

R

raising events, 154-157

RangeValidator control, 433

Read method, 315

ReadAllBytes method, 313, 320

ReadAllLines method, 313, 320-321

ReadAllText method, 313

reader threads, 481

reader-writer locks, 481

reading and writing data, 314-321

ReadLines method, 313, 321

read-only database access, 348

read-only properties, 87

ReadOnlyCollection<T>, 219

reference parameters, 90

reference types, 14-15, 50, 465

garbage collection, 466-467

predefined reference types, 15

reflection, 447

reflection interoperability, 461-462

Refresh method

DirectoryInfo class, 306

FileInfo class, 308

Regex class, 200

regular expressions, 199

classes, 200-201

compatibility, 199

metacharacters, 199-200

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

XML modification, 339-340

RemoveItem method, 218

RemoveWhere method

HashSet<T> class, 219

SortedSet<T> class, 219

removing data, 339-340

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

errors, 33-34

RuntimeWrappedException, 238

S

safety, threads, 477

sbyte type, 51, 53

Scheme property, 58

scope, 16, 79-82

sealing classes, 120

Seconds method, 57

security, 432-433

SEHException, 240

selecting data

with LINQ to SQL, 354

with XML (Extensible Markup Language), 333-337

selection statements, 159

if statement, 160-161

cascaded, 161

“mismatched else” problem, 161

nested, 160

sample application, 161

syntax, 160

switch statement, 162-164

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

sets, 219-225

SetValue method, 338-339

shift operator, 61

short type, 51, 53

short-circuit evaluation, 64

sideloading, 407

signals, 480

signatures, 91

Snap view (Windows Store apps), 405

Solution Explorer, 28

solutions, 27-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

splitting strings, 188-189

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

specifiers, 192-193

ToString method, overriding, 191

standard query operator methods, 296-297

Start Page, 26

StartsWith method, 186

starvation, threads, 477

statement lambdas, 299-300

statements, 15

adding, 31

iteration, 165

do statement, 166-167

foreach statement, 170-171

for statement, 168-169

while statement, 165-166

jump, 171-172

break statement, 172

continue statement, 174

goto statement, 171-172

return statement, 175

next statement, setting, 42-43

selection, 159

if statement, 160-161

switch statement, 162-164

whitespace, 15

static classes, 102-103

static constructors, 100-101

Stream class, 314-315

streams, 303

buffered, 303, 316-318

closing, 309

Stream class, 314-315

StreamWriter class, 318

string type, 51

StringBuilder class, 189-190

strings, 180

case, changing, 186

comparing, 185-187

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

specifiers, 195-196

empty, 182-183

interning, 180

joining, 188-189

literals, 180-181

character escape sequences, 181

verbatim, 181

manipulation, 183-189

modifying, 187-188

mutable, 189-190

naming conventions, 179

regular expressions, 199

classes, 200-201

compatibility, 199

metacharacters, 199-200

substrings, matching, 201

validation with, 201

splitting, 188-189

standard format, 192

specifiers, 192-193

ToString method, overriding, 191

StringBuilder class, 189-190

substrings, 183-185

regular expressions used for matching, 201

ToString method, 182

type formatting, 191

structs, 272

structures, 136

classes compared, 142-143

constructors, 139-142

initializing, 139

methods, 136-141

operator overloading, 137

conversion operators, 138-141

language interoperability, 137

listing of, 137

sample application, 140-141

symmetrical groups, 137

properties, 143

public fields, 143

subscribing, events, 148-151

substrings, 183-185

regular expressions used for matching, 201

Subtract method, 57

subtraction (-) operator, 60

swallowing exceptions, 244

switch statement, 162-164

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

locks, 477-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.Exception, 238-239

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

T

targets

attributes, 439

data binding, 386

Task Parallel Library (TPL), 481

data parallelism, 482-484

concurrent collections, 484

thread-safe collections, 483-484

PLINQ (Parallel LINQ), 487-488

task parallelism, 484-487

exceptions, handling, 486-487

guidelines, 488-489

waiting on tasks, 486

templates (data), 399-400

associating, 400

defining, 399

ternary operator, 61, 65-66

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

locks, 477-480

writer, 481

thread-safe collections, 483-484

throw keyword, 239

throwing exceptions, 239-241

TimeOfDay property, 55

TimeSpan type, 56-57

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

tuples, 278-279

TwoWay data binding, 386, 431-432

type inference used for calling generic methods, 270

type parameters

generics, 265

constraints, 265-268

default values, 268-269

hiding, 269

type target, 439

types, 14-15, 50-51

BigInteger, 59

Complex, 59-60

conversion, 68-70

boxing, 70-71

implicit, 68-70

sample application, 72

unboxing, 70-71

DateTime, 55-56

arithmetic methods, 55

properties, 55

default values, 66

disposable, 468

dispose pattern, 469-470

enumerations, 129-132

defining, 130

flags, 132-135

multiple named values, 131

sample application, 133

underlying type, 132

zero value, 132

formatting, 191

garbage collection, 466-467

IDisposable interface, 467-469

memory organization, 465-466

heap memory, 465-466

stack memory, 465-466

null, 66

nullable, 66-69

null-coalescing (??) operator, 66-69

sample application, 69

pointers, 50

predefined, 51-54

bool, 51

byte, 51

char, 51

CLS-compliance and, 53

decimal, 51-53

double, 51

dynamic, 52

float, 51

GUIDs (globally unique identifiers), 56

implicit conversions, 68-70

int, 51, 53

long, 51, 53

object, 51-52

sbyte, 51, 53

short, 51, 53

string, 51

uint, 51, 53

ulong, 51, 53

ushort, 51, 53

using, 54

var, 53

void, 52

reference, 14-15, 50, 465

garbage collection, 466-467

predefined, 15

structures, 136

classes compared, 136

declaring, 136

methods, 136-141

TimeSpan, 56-57

unified type system, 51

URIs, 56-59

Uri class, 58

UriBuilder class, 58-59

using, 54

using statement, 468-469

value, 14-15, 50, 465

predefined, 15

typography (WPF), 372

U

uint type, 51, 53

ulong type, 51, 53

unary operator, 61

unboxing conversion, 70-71

underlying type, 132

unified type system, 51

UnionWith method

HashSet<T> class, 219

SortedSet<T> class, 219

unit tests, 46

unsubscribing, events, 150-152

upcasting, 112-114

updating records, 357

Uri class, 58

Uri property, 58

UriBuilder class, 58-59

URIs type, 56-59

Uri class, 58

UriBuilder class, 58-59

user interface considerations, 413

UserName property, 58

ushort type, 51, 53

using statement, 468-469

UtcNow property, 55

V

ValidatesOnDataErrors property, 397

ValidatesOnException property, 397

validation, 396-399

arguments, 239

client-side validation

CompareValidator control, 433

CustomValidator control, 433

RangeValidator control, 433

RegularExpressionValidator control, 433

RequiredFieldValidator control, 433

controls, 433-435

ControlToValidate property, 434

Display property, 434

ErrorMessage property, 434

with regular expressions, 201

Text property, 434

Web applications, 432-435

client-side validation, 433-435

sample application, 433-435

security, 432-433

server-side validation, 432-433

ValidationRules property, 396-397

value equity, testing for, 267-268

value parameters, 90

value types, 14-15, 50, 465

predefined, 15

Values method, 220

var type, 53

variable windows, 36-37

variables, 15-17

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

Visual Studio, 26-28, 372

Call Stack window, 41-42

debugging code, 32-33

breakpoint, 39-40

Call Stack window, 41-42

compiler errors, 33-34

DataTips, 37-38

Exception Assistant, 34-35

exception point, 34-35

execution of program, controlling, 40-43

Immediate window, 38

runtime errors, 33-34

tracepoints, 40

unit tests, 46

variable windows, 36-37

visualizers, 43-44

editions, 26

items, 28

projects, 27-28

creating, 28-31

running applications, 32

Solution Explorer, 28

solutions, 27-28

Start Page, 26

statements

adding, 31

next statement, setting, 42-43

writing your first program, 28-32

visualizers, 43-44

void type, 52

W

Wait method, 479

waiting on tasks, 486

Web applications, 420

ASP.NET, 420-423

browser communication, 420

creating, 423-432

CSS files, 429-430

data binding, 431-432

adding binding expressions, 431

Bind method, 432

Eval method, 431-432

one-way, 431-432

two-way, 431-432

data validation, 432-435

client-side validation, 433-435

sample application, 433-435

security, 432-433

server-side validation, 432-433

Global.asax event handlers, 423

inline styles, 430

layout

creating, 426-428

styling, 429-430

master pages, 426-427

Page event handlers, 422

Web Forms, 420

while statement, 165-166

sample application, 166

for statement compared, 169

syntax, 165

whitespace, 15

Wiltamuth, Scott, 1

Windows folder, 305

Windows Runtime, 378, 404-405

asynchrony, 408-412

naming conventions, 411

sample application, 410

threads and, 408

.NET Framework compared, 404-405

Windows Store apps, 405-408

app bar, 406-407

building, 412-417

charms, 406-407

enterprise access to, 407

layout, creating, 413-417

new controls, 406-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

layout, creating, 376-380

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

applications, 368-369

App.xaml file, 381

code-behind, 367-369

data binding, 372, 385-387

collection view, 388-390

collections, implementing, 390

components, 386

creating, 387-392

current item pointers, 392

OneTime, 386

OneWay, 386

OneWayToSource, 386

SortDescription structure, 389

target, 386

TwoWay, 386

data conversion, 392-393

ConverterParameter property, 396

creating converters, 392-393

multivalue converters, 394-396

data templates, 399-400

associating, 400

defining, 399

data validation, 396-399

documents, 372

graphics, 371

layouts, 370-371

Canvas, 370

default layout controls, 370

DockPanel, 370-371

Grid, 370

resource dictionaries, 381-382

StackPanel, 370

styling, 381-382

WrapPanel, 370

markup, 366-367

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 comments, 45-46

writing your first program, 28-32

X

XAML (Extensible Application Markup Language), 366-367

applications, 368-369

browser applications, 369

CollectionViewSource class, 388

photo viewer application layout, 379-380

x:Class attribute, 367

x:Name attribute, 380

XAML designer, 374

XAttribute class, 328-331

XBAPs (XAML browser applications), 369

x:Class attribute, 367

XDocument class, 327

XElement class, 328-331

XML (Extensible Markup Language), 325

adding data, 340

creating XML with

DOM (Document Object Model) XML, 328-329

LINQ to XML, 328

namespaces, 331-333

DOM (Document Object Model), 326-327

creating XML with, 328-329

queries, 335

encoding and decoding characters, 329

LINQ to XML, 327

creating XML with, 328

namespaces, 331-334

queries, 335-336

SetAttributeValue class, 330-331

SetElementValue class, 330-331

XAttribute class, 328-331

XDocument class, 327

XElement class, 328-331

XName class, 331-334

XNamespace class, 331-334

modifying, 338-341

namespaces, 331

atomization, 333

creating XML with, 331-333

sample application, 334

querying with, 333-337

removing data, 339-340

replacing data, 339

selecting with, 333-337

XNode class, 333-335

XML comments, 44-45

x:Name attribute, 380

XName class, 331-334

XNamespace class, 331-334

XNode class, 333-335

XPathEvaluate method, 335

XPathSelectElement method, 336

XPathSelectElements method, 336

XPS (XML Paper Specification) documents, 372

Y-Z

Year property, 55

zero value, 132

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.133.180