Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Pro CSharp And The .NET 2.0 Platform (2005) [eng]

.pdf
Скачиваний:
111
Добавлен:
16.08.2013
Размер:
10.35 Mб
Скачать

964 I N D E X

Emit( ) method, System.Reflection.Emit.

event handling in ToolStrips, Visual Studio 2005,

ILGenerator, 506

643

EmitCall( ) method, System.Reflection.Emit.

event interface, 256–57, 259

ILGenerator, 506

EventBuilder, System.Reflection.Emit

emitting dynamic assembly, 506–13

namespace, 505

Emitting HTML, ASP.NET, 860

EventInfo class, System.Reflection namespace,

EmitWriteLine( ) method,

396

System.Reflection.Emit.ILGenerator,

events

506

adding to custom controls, 741

EnableThemeing property,

compared with delegates, 277

System.Web.UI.Control in ASP.NET, 867

event keyword, 277

EnableTheming, ASP.NET <%@Page%>

example, 277

directive attribute, 846

explanation, 278–79

EnableViewState, ASP.NET <%@Page%>

listening to incoming events, 279–80

directive attribute, 846

Microsoft recommended pattern, 281–82

EnableVisualStyles( ) method, Application class,

overview, 255

609

registration, 279–81

encapsulation

exception handling, structured

accessor (get) and mutator (set) methods,

advantages, 199

148

application-level exceptions, 208–10

black box programming, 148

bugs, description, 197

class properties, 149–53

catching exceptions, 203–4

description, 145

configuring exception state, 204

get, set keywords for class properties, 149–50

custom exceptions, 209–10

get, set properties vs. accessor and mutator

entities used in, 199

methods, 150–53

exceptions, description, 197

public fields and data validation, 148

finally block, 215–16

read-only class properties, 153–54

generic exceptions, 202, 213

static class properties, 154–55

inner exceptions, 214–15

visibility of get/set statements, 153

keywords used, 199

write-only class properties, 153–54

multiple exceptions, 212–13

End( ) method, ASP.NET HTTP Response, 860

overview, 197

EndExceptionBlock( ) method,

possible .NET exceptions, 216

System.Reflection.Emit.ILGenerator,

rethrowing exceptions, 214

506

simple example, 200, 202–4

EndInvoke( ) method, multithreaded

System.Exception, 199–200, 202–4

applications, 453–54

system-level exceptions, 208

EndInvoke( ) method, SoapHttpClientProtocol

System.Serializable attribute, 211

class, 944

template, exception, 211

EndScope( ) method,

throwing an exception, 202–3

System.Reflection.Emit.ILGenerator,

traditional exception handling, 198

506

try/catch block, 203–4

EnforceConstraints property, ADO.NET DataSet

typed exceptions, 217

class, 795

unhandled exceptions, 217

EnumBuilder, System.Reflection.Emit

user errors, description, 197

namespace, 505

Visual Studio 2005 features, 216, 218–19

enumerable types (IEnumerable and

Exchange( ) method, Interlocked type,

IEnumerator), 235–37

multithreaded applications, 472

enumerating controls with Panel control,

exe compile target, 607

ASP.NET, 867–68

ExecutablePath property, Application class, 609

enumeration types, 17

ExecuteAssembly( ), System.AppDomain, 436

enums, 107–10, 491

ExecuteNonQuery( ), DbCommand, ADO.NET,

Equals( ), System.Object instance-level

782

member, 111

ExecuteReader( ), DbCommand, ADO.NET, 782

Error event, ASP.NET, 863–64

ExecuteScalar( ), DbCommand, ADO.NET, 782

error processing members, ADO.NET DataRow

ExecuteXmlReader( ), DbCommand, ADO.NET,

object, 798

782

ErrorBlinkStyle properties, controls, 730

Exit( ) method, Application class, 609

ErrorProviders, 729–31

ExitCode, System.Diagnostics.Process, 428

escape characters, summary, 124

ExitTime, System.Diagnostics.Process, 428

I N D E X 965

explicit casting, 170–71, 224–25

life cycle, 619

explicit interface implementation, 229–31

methods, 618

explicit keyword, custom type conversion,

properties, 618

302–4

form control declarations, ASP.NET, 847

Expression property, ADO.NET DataColumn

form data, access in ASP.NET, 858–59

object, 797

form inheritance, 752–54

eXtensible Markup Language. See XML

Form object inheritance chain, 612

Extension property, FileSystemInfo class, 519

Form, System.Windows.Forms, 606

externally referenced assemblies, in common

Format( ) method, System.Enum, 109

intermediate language (CIL), 488

forms, 605

F

forms controls, 699

Forth .NET programming language, 8

field directive, common intermediate language

Fortran .NET programming language, 8

(CIL), 493

FullName property, FileSystemInfo class, 519

FieldBuilder, System.Reflection.Emit

fully qualified type names, 134–36

namespace, 505

FxCop development tool, 62

FieldInfo class, System.Reflection namespace,

G

396

File class, System.IO, 529, 531

GAC, default location in Windows, 25, 371

File, FileInfo types, input/output, System.IO,

GAC utility, gacutil.exe, 35

518–19

garbage collection

FileAttributes enum, FileSystemInfo class, 521

AddMemoryPressure( ) method, 185

FileInfo class, System.IO, 526–29

AddRef( ) not required, 181

FileStream class, System.IO, 532–33

application domain, 188

FileStream type, input/output, System.IO, 518

application roots, 182

FileSystemInfo class, 519

code example, 185–87

FileSystemWatcher class, System.IO, 540–41

Collect( ) method, 185–87

FileSystemWatcher type, input/output,

CollectionCount( ) method, 185

System.IO, 518

compared with C++, 181

Fill( ) method, ADO.NET, data adapter, 811

finalizable objects, 188

filters, ADO.NET, 807–8

finalization details, 191

finalizable objects, 188

forcing, 186–87

finalization details, 191

GetGeneration( ) method, 185

finalize( ), overriding, 189–90

GetTotalMemory( ) method, 185

Finalize( ), System.Object instance-level

MaxGeneration property, 185

member, 112

memory leaks, 72

finally block, structured exception handling,

object generations, 184

215–16

object graph use, 182–83

FindMembers( ) method, System.Type class,

overriding finalize( ), 189–90

397

overview, 179

fixed keyword, 315

PInvoke, 189

FlatStyle property, Button, 709, 711

reachable objects, 180

FlowLayoutPanel, controls, 756–57

Release( ) not required, 181

Flush( ) method

SuppressFinalize( ) method, 185

ASP.NET HTTP Response, 860

System.GC, 185

BinaryWriter class, 538

threads suspended, 182

Stream class, System.IO, 532

timing of, 181

TextWriter, System.IO, 534

unmanaged resources, 185, 189–90, 193

FontDialog class, GDI+, 671–72

WaitForPendingFinalizers( ) method, 185–86

fonts, GDI+, 665

when heap objects are removed, 180, 182

enumerating, 669–70

GDI+

faces and sizes, 667, 669

color values, 663

families, 666–67

ColorDialog class, 664–65

for loop, 92

coordinate systems, 659–60

forcing garbage collection, 186–88

core namespaces, 649

foreach loop, 93

custom point of origin, 662

Form class

disposing graphics objects, 658–59

events, 618–19

FontDialog class, 671–72

example program, 619–20

fonts, 665

966 I N D E X

enumerating, 669–70

435

faces and sizes, 667, 669

GetDirectories( ) method, DirectoryInfo class,

families, 666–67

519

hit testing nonrectangular images, 688, 690

GetDomain( ), GetDomainD( ) methods, Thread

hit testing rendered images, 687–88

type, 460

methods in FontFamily, 666

GetEnumerator( ) method, ControlCollection,

namespaces, 650

702

overview, 649

GetEvents( ) method, System.Type class, 396

PageUnit property, custom unit of measure,

GetFactory( ) method, ADO.NET, 771

661–62

GetFields( ) method, System.Type class, 396

Pen properties, 673

GetFiles( ) method, DirectoryInfo class, 520–22

Pens collection, 673

GetHashCode( ), System.Object instance-level

PictureBox type, 684–86

member, 111

System.Drawing namespace, 650

GetInterfaces( ) method, System.Type class, 396

System.Drawing.Brush, 677

GetInvocationList( ) method,

HatchBrush, 678–79

System.MulticastDelegate/System

LinearGradientBrush, 681

Delegate, 263

TextureBrush, 679–80

GetLifetimeServices( ),

System.Drawing.Drawing2D, 672

System.MarshalByRefObject, 572

Pen types, 673–74

GetMembers( ) method, System.Type class, 396

Pens, LineCap, 675–76

GetMethods( ) method, System.Type class, 396

System.Drawing.Font, 665

GetName( ) method, System.Enum, 109

System.Drawing.Graphics class, 653

GetNestedTypes( ) method, System.Type class,

System.Drawing.Image, 682, 684

396

unit of measure, 660

GetObjectData( ) method, serialization, 558–60

generic method

GetParentRelations( ) method, ADO.NET

example code, 329–32

DataSet class, 795

type parameter omission, 330–32

GetProcesses( ), System.Diagnostics.Process,

generic structures, classes, 332–33

429

generics

GetProperties( ) method, System.Type class, 396

base classes, 339–40

GetRegisteredActivatedClientTypes( ) method,

boxing and unboxing issues, 321–25

RemotingConfiguration, 580

constraining type parameters using where,

GetRegisteredWellKnownClientTypes( )

335–38

method, RemotingConfiguration, 580

custom generic collections, 334–35

GetRegisteredWellKnownServiceTypes( )

default keyword, 333

method, RemotingConfiguration, 580

delegates, 341–42

GetSchema( ) method, DbConnection,

delegates using .NET 1.1, 342–43

ADO.NET, 779

generic methods, 329–32

get/set

interfaces, 340–41

accessor and mutator methods comparision,

lack of operator constraints, 338–39

150–52

nested delegates, 343

visibility of statements, 153

overview, 321

GetType( ) method

System.Collections.Generic.List<>, 325–26

System.Object class, 397

uses of, 321–25

System.Object instance-level member, 111

Gephardt, Sean, 45

System.Type class, 397

GET and POST, ASP.NET, 837–38

GetUnderlyingType( ) method, System.Enum,

GET data type, 940

109

GetAssemblies( ), System.AppDomain, 436

GetUrlsForObject( ) method, remoting

GetChanges( ) method, ADO.NET DataSet class,

ChannelServices, 579

795

GetValues( ) method, System.Enum, 109

GetChannel( ) method, remoting

Global Assembly Cache (GAC)

ChannelServices, 579

and assemblies, 348

GetChildRelations( ) method, ADO.NET DataSet

default location in Windows, 25, 371

class, 795

internal composition, 382, 384

GetConstructors( ) method, System.Type class,

overview, 25

396

Global.asax file, ASP.NET, 894–96

GetCurrentProcess( ),

globalization element, Web.config, ASP.NET, 913

System.Diagnostics.Process, 429

Globally Unique Identifier (GUID), 240–42, 371,

GetCurrentThreadId( ), System.AppDomain,

373

Graphics object with no Paint event, GDI+, 657 GraphicsPath class, methods, GDI+, 689 GroupBox control, 711, 713

GUI programming overview, 605

Visual Studio 2005, 621

H

Handle, System.Diagnostics.Process, 428 HandleCount, System.Diagnostics.Process, 428 has-a relationship code example, 159–60 HasChanges( ) method, ADO.NET DataSet

class, 795

HasControls( ) method, System.Web.UI.Control in ASP.NET, 867

HasErrors property, ADO.NET DataSet class, 795

Hashtable System.Collections class type, 250 HatchBrush, System.Drawing.Brush, 678–79 heap, and reference types, 98

HelpLink property, System.Exception, 200, 206 Hexadecimal property, NumericUpDown, 728 historical overview of programming

C++/MFC, 4

Component Object Model (COM), 5 C/Win32, 3

Java/J2EE, 4 Visual Basic 6.0, 4 Windows DNA, 5

hit testing

nonrectangular images, 688, 690 rendered images, 687–88

HTML

and ASP.NET, overview, 832 document structure, 833 form development, 833

HTTP channel, remoting, 568 HTTP Request, ASP.NET, 858

HTTP Request processing, ASP.NET, 857–59 HTTP Response processing, ASP.NET, 859–61 HTTP transport of web service, 922 HttpApplication members, ASP.NET, 897 HttpApplication type overview, 889 HttpApplicationState members, ASP.NET, 898 HybridDictionary,

System.Collections.Specialized, 253

I

IasyncResult interface, 260–61

ICollection System.Collections interface, 247–48 ICollection System.IDictionaryEnumerator

interface, 249

ICollection System.Idictionaryinterface, 248 ICollection System.IList interface, 249 IComparer System.Collections interface, 247 icons, custom controls, 748–49

Id, ProcessThread type, 432

ID property, System.Web.UI.Control in ASP.NET, 867

I N D E X 967

Id, System.Diagnostics.Process, 428 IDataAdapter, System.Data, ADO.NET, 765 IDataParameter, System.Data, ADO.NET, 765 IDataReader, System.Data, ADO.NET, 765 IDbCommand interface, ADO.NET, 766 IDbCommand, System.Data, ADO.NET, 765 IDbConnection interface, ADO.NET, 765 IDbDataAdapter, IDataAdapter interface,

ADO.NET, 767

IDbDataAdapter, System.Data, ADO.NET, 765 IDbDataParameter, IDataParameter interface,

ADO.NET, 766 IDbDataReader, IDataReader interface,

ADO.NET, 767–68 IDbTransaction interface, ADO.NET, 765 IdealProcessor, ProcessThread type, 432 identity, private assemblies, 365

IDictionary System.Collections interface, 247 IDictionaryEnumerator System.Collections

interface, 247

IDisposable interface, unmanaged resources, 191–93

Idle event, Application class, 609 IEnumerable System.Collections interface, 247 IEnumerator, IEnumerable interfaces, indexer

technique, 290

IEnumerator System.Collections interface, 247 if/else statement, 94

IHashCodePRovider System.Collections interface, 247

IIS

default web site, 830

deployment, XML web service, 925 description, 830

virtual directories, 831

IKeyComparer System.Collections interface, 247

ilasm.exe compiler, common intermediate language (CIL), 477

ildasm exploration of manifest, 357 ILease interface remoting, 593 ILGenerator, System.Reflection.Emit

namespace, 505

IList System.Collections interface, 247 image processing in custom controls, 739–41 Image property, Button, 709

Image type core members, 682 ImageAlign property, Button, 709

images in ToolStrips, Visual Studio 2005, 641–43 implicit cast, 171

implicit keyword, custom type conversion, 302–6

Increment( ) method, Interlocked type, multithreaded applications, 472

Increment property, NumericUpDown, 728 indexer technique

CIL internal code, 292 example, 290–91

IEnumerator, IEnumerable interfaces, 290 multidimensional collections, 293

968 I N D E X

overview, 289 System.Collection.ArrayList, 290–91 System.Collections.Specialized.

ListDictionary, 291–92 this[ ] syntax, 290–91

inheritance, 146, 752–54

base keyword in class creation, 156–57 colon operator, 155 containment/delegation inheritance model,

159–60 description, 146

has-a relationship code example, 159–60 is-a relationship code example, 155–56 multiple base classes not allowed, 157 picker utility, 753–54

protected keyword, 158 sealed classes, 159, 164

inheritance chain, page type in ASP.NET, 855–56 Inherits, ASP.NET <%@Page%> directive

attribute, 846

Init, ASP.NET Page events, 862 InitializeComponent( ) method, 703 InitializeLifetimeServices( ),

System.MarshalByRefObject, 572 InitialLeaseTime, ILease interface remoting, 593 InnerException property, System.Exception,

200

in-place editing example, ASP.NET, 879–80 input/output, System.IO

asynchronous I/O, 542–43 BinaryReader, BinaryWriter, 538–39 BinaryReader, BinaryWriter types, 517 BufferedStream type, 517

Directory, DirectoryInfo types, 517–19 Directory type, 523–24

DriveInfo class, 524–25 DriveInfo type, 517 File class, 529, 531

File, FileInfo types, 518–19 FileInfo class, 525 FileStream class, 532–33 FileStream type, 518

FileSystemWatcher class, 518, 540–41 MemoryStream type, 518 namespace description, 517 overview, 517

Path type, 518

reading from a text file, 535 Stream class, 531

StreamReader, StreamWriter, 533 StreamWriter, StreamReader types, 518 StringReader, StringWriter, 536–37 StringWriter, StringReader types, 518 writing to a text file, 534–35

InsertCommand property in updating, ADO.NET, 814

inserting records, ADO.NET, 786 installing .NET 2.0 Framework SDK, 33

InterceptArrowKeys property, UpDownBase, 728

interface keyword, 221 interfaces

abstract base class comparison, 224 in arrays, 228

cloneable objects (ICloneable), 238–42 colon operator, 222

common intermediate language (CIL), 490 comparable objects (IComparable), 242–44 custom interface example, 221–22

custom properties and sort types, 246 and data providers, ADO.NET, 768–69 deep copy, 242

definition, 221

determining using as keyword, 225 determining using explicit cast, 224–25 determining using is keyword, 225–26 enumerable types (IEnumerable and

IEnumerator), 235–37 explicit implementation, 229–31 hierarchies, 232

implementing, 223

invoking objects based on, 224 multiple base interfaces, 233

multiple sort orders (IComparer), 245–46 name clashes, 229–31

overview, 221 shallow copy, 238–41

struct, derive from System.ValueType, 222 System.Collections interfaces, 247 System.Object base class, 222

types, 17

using as a parameter, 226–27 using as a return value, 228 Visual Studio 2005, 234–35

Interlocked type, multithreaded applications, 472

Interlocked type, System.Threading Namespace, 459

Intermediate Language Disassembler utility (ildasm.exe)

CIL code display, 27 icons, 26

manifest display, 28 overview, 26

type metadata display, 28 intermediate language (IL), 10 internal access modifier, 77 Interrupt( ) method, Thread type, 460

intrinsic types in CTS, VB.NET, C#, C++, 18 Invalidate( ) method and Paint event, GDI+,

656–57

InvalidCastException, boxing and unboxing, 322 inventory content page example, ASP.NET,

877–78

Invoke( ) method, SoapHttpClientProtocol class, 944

InvokeAsync( ) method, SoapHttpClientProtocol class, 945

InvokeMember( ) method, System.Type class, 397

IPC channel, remoting, 568, 583 is keyword, 107

determining interface support, 225–26 determining type, 172

is-a relationship code example, 155–56 IsAbstract, System.Type class, 396 IsAlive method, Thread type, 460 IsArray, System.Type class, 396 IsBackground method, Thread type, 460 IsClass, System.Type class, 396 IsCOMObject, System.Type class, 396 IsDefined( ) method, System.Enum, 109 IsEnum, System.Type class, 396 ISerializable interface, 557

IsGenericParameter, System.Type class, 396 IsGenericTypeDefinition, System.Type class,

396

IsInterface, System.Type class, 396 IsNestedPrivate, System.Type class, 396 IsNestedPublic, System.Type class, 396 IsNull( ) method, ADO.NET DataRow object,

799

IsNullable property, ADO.NET DbParameter, 789

IsPostBack property in HTTP Request processing, ASP.NET, 859

IsPrimitive, System.Type class, 396 IsSealed, System.Type class, 396 IsValueType, System.Type class, 396 IsWellKnownClientType( ) method,

RemotingConfiguration, 580 ItemArray, ADO.NET DataRow object, 798 Items property, DomainUpDown, 728 iteration, 92–93

iteration, common intermediate language (CIL), 499

J

Java/J2EE language deficiencies, 4 Jitter, just-in-time (JIT) compiler, 14 Join( ) method, Thread type, 460

K

key, CIL compiler flags, 485

Kill( ), System.Diagnostics.Process, 429

L

Label control, 704–5 language fundamentals

?? operator, 133 arrays, 127–30

basic program structure, 65–66 basic string operations, 123–24 boxing and unboxing, 104–6

C++ program structure compared with C#, 65 class definition and instantiation, 72

class member variable default values, 78 classes, definition, 69

command-line arguments, 67–68

I N D E X 969

constant data, 80 constructors, 70–71

custom namespaces, 133–34 decisions, 94–96

default constructor, 70–71

defining classes and creating objects, 69–70 destroying objects, 72

enums, 107–10 escape characters, 124

for, foreach looping, 67 foreach loop, 93

fully qualified type names, 134–36 garbage collection, 72 GetCommandLineArgs( ), 67 internal vs external constant data, 81 is keyword, 107

iteration, 92–93

local variable default values, 79 for loop, 92

Main( ) method, 66

member variable initialization syntax, 79–80 member visibility, 76–78

method parameter modifiers, 89 namespaces, default Visual Studio 2005, 138 nested namespaces, 137–38

.NET formatting flags, 75–76 new keyword, 69–70 nullable types, 131, 133 objects, definition, 69 overview, 65 parameter-passing, 89–91

parsing values from string data, 121 passing reference types by reference, 102 passing reference types by value, 101–2 read-only fields, 82–83 relational/equality operators, 94–96 static classes, 88

static constructors, 86–87 static data, 84–86

static keyword, 83–88 static methods, 84

static read-only fields, 83 String.Concat( ) method, 124 strings, 124

System data types, 117–20 System.Array, 130 System.Boolean, 120 System.Char, 121 System.Console class, 73–75 System.DateTime, 122 System.Environment class, 68–69 System.Nullable<T>, 132 System.Object, 111–17 System.String data type, 123 System.Text.StringBuilder, 126–27 System.TimeSpan, 122 System.ValueType, 97

type visibility, 78

unboxing custom value types, 106 user-defined type (UDT), definition, 69–70

970 I N D E X

using aliases, 136–37

MapPath( ) method, ASP.NET HTTP Request, 858

value types and reference types, 96–100,

mapping

103–4

C# types to CIL types, 492–93

verbatim strings, 125

DBMS names, ADO.NET, 813

while, do/while loops, 93

parameters to variables, CIL, 498

LargeChange property, TrackBar control, 724

marshaling, remoting, 570

LastAccessTime property, FileSystemInfo class,

MaskedTextBox control, 707, 709

519

master pages example, ASP.NET, 872–73

LastWriteTime property, FileSystemInfo class,

MasterPageFile, ASP.NET <%@Page%> directive

519

attribute, 846

late binding

MasterPageFile, Page Type properties, ASP.NET,

description, 406

856

invoking methods with no parameters, 407

Maximum, Minimum properties, TrackBar

invoking methods with parameters, 407–8

control, 724

overview, 391

Maximum property, NumericUpDown, 728

System.Activator class, 406–7

maxstack directive, common intermediate

layout components, System.Windows.Forms,

language (CIL), 497

606

MBV remoting, 586–89

layout, controls, 756–57

client assembly, 588–89

lease-based lifetimes, remoting, 592–97

server assembly, 587–88

Length, FileInfo class, System.IO, 526

MDI applications, Visual Studio 2005, 646

Length( ) method, Stream class, System.IO, 532

member variable initialization syntax, 79–80

life cycle of a web page, ASP.NET, 861–63, 865

member visibility, 76–78

LinearGradientBrush, System.Drawing.Brush,

MemberInfo class, System.Reflection

681

namespace, 396

ListBox control, 715–16

MemberwiseClone( ), System.Object instance-

ListDictionary, System.Collections.Specialized,

level member, 112

253

memory allocation (unsafe), 314–15

Load( ), System.AppDomain, 436, 438

memory management

Load, ASP.NET Page events, 862

first rule, 180

local variable default values, 79

second rule, 182

LocalBuilder, System.Reflection.Emit

third rule, 189

namespace, 505

fourth rule, 192

locals directive, common intermediate

Finalize( ) vs. IDisposable interface, 194–95

language (CIL), 498

resource wrapper Microsoft code example,

Lock( ) method, ASP.NET HttpApplicationState

194–95

member, 898

memory management in CIL, 181–82

lock token and multithreaded applications,

MemoryStream type, input/output, System.IO,

469–71

518

locking memory (unsafe), 315

menu components, System.Windows.Forms,

looping, 92–93

606

Lutz Roeder’s Reflector for .NET development

menu control example, ASP.NET, 873

tool, 62

Menu selection prompts, Visual Studio 2005,

M

639

menu sytems, Visual Studio 2005, 634, 636–37

machine.config, 388

Merge( ) method, ADO.NET DataSet class, 795

MachineName, System.Diagnostics.Process,

message element, WSDL document elements,

428

938

Main( ) method, multithreaded applications,

Message property, System.Exception, 200, 210

457

metadata and type reflection, 392, 398–402

MainModule, System.Diagnostics.Process, 428

method group conversions, C# 2.0, 285–86

maintaining session data, ASP.NET, 906–8

method hiding, description, 169–70

MainWindowHandle,

method parameter modifiers, 89

System.Diagnostics.Process, 428

Method property,

MainWindowTitle, System.Diagnostics.Process,

System.MulticastDelegate/System

428

Delegate, 263

managed code, 8

MethodBuilder, System.Reflection.Emit

managed heap, 180–84

namespace, 505

manifest, assemblies, 348

MethodInfo class, System.Reflection

 

namespace, 396

methods

common intermediate language (CIL), 494–95

in FontFamily, GDI+, 666 Microsoft Express IDEs, overview, 50

Microsoft recommended event pattern, 281–82 Minimum property, NumericUpDown, 728 mnemonic keys in Label control, 704–5 mnemonics, CIL, 479

modifying application data, ASP.NET, 899–900 modifying tables, Command object, ADO.NET,

784–86

Module class, System.Reflection namespace, 396

module directive, common intermediate language (CIL), 488

module set for a process example code, 432–33 ModuleBuilder, System.Reflection.Emit

namespace, 505, 509–10 Modules, System.Diagnostics.Process, 428

Monitor type, System.Threading Namespace, 459

MonthCalendar control, 719–21 MoveTo( ) method

DirectoryInfo class, 520 FileInfo class, System.IO, 526

mresources directive, common intermediate language (CIL), 489

mscoree.dll, Common Language Runtime (CLR), 20–21, 425

MSIL vs. CIL, 10

multicast delegate call, 262 multicasting, delegates, 268–70 multifile assemblies, 11, 352, 362–65 multiple base classes not allowed, 157 multiple base interfaces, 233 multiple exceptions, 212–13

multiple .NET Framework versions, 445 multiple result sets, DbDataReader object,

ADO.NET, 784

multiple sort orders (IComparer), 245–46 multitabled DataSet objects, ADO.NET, 817–20 multithreaded applications

AsyncCallback delegate, 456–57 asynchronous operations, 453–54 AsyncResult class, 457–58 atomic operations, 450 BeginInvoke( ), 453–54, 456–58 CLR thread pool, 475–76 concurrency, 450, 467–70 delegate review, 451, 453 EndInvoke( ), 453–54

execution speed vs. responsiveness, 465 foreground vs. background threads, 466–67 lock keyword and synchronization, 469–71 Main( ) method, 457

overview, 449

secondary thread creation, 462–63 state data, 458

synchronization, 450

I N D E X 971

synchronization attribute, 472–73 synchronizing threads, 455–56 synchronous operations, 451, 453 System.Threading Namespace, 459 System.Threading.Interlocked type and

synchronization, 471–72 Thread class, 449

thread relationship to process, AppDomain, and context, 449–51

thread-volatile operations, 450 Timer callbacks, 473–74

Mutex type, System.Threading Namespace, 459

N

name clashes in interfaces, 229–31 Name, FileInfo class, System.IO, 526 Name method, Thread type, 460–61 Name property, FileSystemInfo class, 519

namespace directive, common intermediate language (CIL), 489

namespace keyword, 133–34 namespaces, 22–25

namespaces, default Visual Studio 2005, 138 NameValueCollection,

System.Collections.Specialized, 253 Nant development tool, 62

navigating between related tables, ADO.NET, 820–21

NDoc development tool, 62 nested namespaces, 137–38 nested type definitions, 161–62

.NET 1.x controls in Visual Studio 2005, 623

.NET Framework

base class libraries, 7

basic building blocks overview, 6 Common Language Infrastructure(CLI),

29–30

common language runtime (CLR) overview, 6 Common Language Specification (CLS)

overview, 6

Common Type System (CTS) overview, 6 Configuration utility, 369–70, 382

core features, 6

ECMA standardization, 29 interoperability with COM, 6 Mono, 30

.NET-aware programming languages, 8–9 non-Windows platforms, 29–30 overview, 6

Portable .NET, 30

Virtual Execution System (VES), 29 web links to .NET-aware languages, 8–9

.NET runtime deployment, 29

.NET type metadata initial example, 14–15 overview, 14

.NET, why learn it, 3

netmodule file extension, 352, 362–64

972I N D E X

new keyword, 69–70

CIL implementation, 181 references, 180

NewLine, TextWriter, System.IO, 534 newobj CIL instruction, 181 noautoinherit, 485, CIL compiler flags node images in TreeViews, 734, 736 nonrectangular images, GDI+, 688, 690 nullable types, 131, 133 NullReferenceException, delegates, 267–68 numeric System data types, 120 NumericUpDown, 728

Nunit development tool, 62

O

Oberon programming language, 8 object contexts

boundaries, 440 context 0, 440 context-agile, 441 context-bound, 441–42 overview, 425

program example, 442–43 object generations, 184 object graph

definition, 546

garbage collection, 182–83 reachable objects, 182–83 relationships, 547

simple example, 546–47 object keyword, boxing, 104–6 object lifetime

object generations, 184 overview, 179 System.GC, 185

when heap objects are removed, 180, 182 object oriented programming, 317–19

class, description, 139

class public interfaces, 144–45 constructors, example Employee class, 140 example Employee class, 139, 141 forwarding constructor calls using this, 143 has-a relationship, 146

is-a relationship, 146 method overloading, 141 overview, 139

Pillars of OOP, 4 encapsulation, 145, 148 inheritance, 146, 155 polymorphism, 147, 162

state of a class instance, description, 139 this keyword, 142–43

ObjectIDGenerator, serialization, 557 objects

definition, 69

differences from classes and references, 179 Obsolete attribute, 408–9 OnDeserializedAttribute, serialization, 557 OnDeserializingAttribute, serialization, 557

OnSerializedAttribute, serialization, 557 OnSerializingAttribute, serialization, 557 opcodes, CIL, 479, 495–97

OpCodes, System.Reflection.Emit namespace, 505

Open( ) method, FileInfo class, System.IO, 526–27

OpenRead( ) method, FileInfo class, System.IO, 526, 528

OpenText( ) method, FileInfo class, System.IO, 526, 528

OpenWrite( ) method, FileInfo class, System.IO, 526, 528

operator constraints, lack of with generics, 338–39

operator overloading binary operators, 294–95

C# to CIL special names index, 299 cautions, 301

CIL internal code, 298–99 comparison operators, 297–98 description, 293

equality operators, 296–97

operation overloading in other languages, 299–300

operator keyword, 295

operators that can be overloaded, 293 overview, 289

shorthand assignment operators, 295 unary operators, 296

OptionalFieldAttribute, serialization, 557 Ordinal property, ADO.NET DataColumn

object, 797

Orientation property, TrackBar control, 724 origin point, GDI+, 662

out method parameter modifier, 89–90 outer variables, 284–85

output, CIL compiler flags, 485 overflow/underflow, 307–9

override keyword, description, 163–64

P

page coordinates, GDI+ coordinate systems, 659 Page events, ASP.NET, 862

Page property, System.Web.UI.Control in ASP.NET, 867

Page Type properties, ASP.NET, 856–57 PageUnit property, custom unit of measure,

GDI+, 661–62 Paint event, GDI+, 656 Panel control, 726–27

parameter, interface used as, 226–27 Parameter object, ADO.NET data providers, 761 ParameterBuilder, System.Reflection.Emit

namespace, 505 ParameterInfo class, System.Reflection

namespace, 396

parameterized command objects, ADO.NET, 788

I N D E X 973

ParameterizedThreadStart delegate,

primary thread, 426

System.Threading Namespace, 459,

Priority method, Thread type, 460, 462

462–66

PriorityBoostEnabled,

ParameterName property, ADO.NET

System.Diagnostics.Process, 429

DbParameter, 789

PriorityClass, System.Diagnostics.Process, 429

parameter-passing, 89–91

PriorityLevel, ProcessThread type, 432

Parameters, DbCommand, ADO.NET, 782

private access modifier, 77

params method parameter modifier, 89, 91

private assemblies

parent forms in MDI applications, 646

configuration, 366, 368

Parent property

description, 365

DirectoryInfo class, 520

identity, 365

System.Web.UI.Control in ASP.NET, 867

probing, 366, 368

Parse( ) method, System.Enum, 109

Process class, System.Diagnostics namespace,

parsing values from string data, 121

428

partial type modifier, 173–74

process identifier (PID), 425, 429–31

passing reference types, 101–2

processes

PasswordChar property, Textbox, 705

definition, 425

Path, setting, 35

module set example code, 432–33

Path type, input/output, System.IO, 518

overview, 425

Peek( ) method, TextReader, System.IO, 535

process manipulation example code, 429–30

PeekChar( ) method, BinaryReader class, 538

starting and stopping example code, 434–35

Pen properties, GDI+, 673

System.Diagnostics namespace, 427

Pens collection, GDI+, 673

thread examination example code, 430–31

persistence of cookies, ASP.NET, 909–10

ProcessExit event, System.AppDomain, 436,

persisting datasets as XML, ADO.NET, 803

439–40

peverify.exe tool, compiling common

ProcessModule type, System.Diagnostics

intermediate language (CIL), 487

namespace, 428

philosophy of .NET, overview, 3

ProcessModuleCollection, System.Diagnostics

PictureBox type, 684–86

namespace, 428

Pillars of OOP, 4

ProcessName, System.Diagnostics.Process, 429

encapsulation, 145, 148

ProcessorAffinity, ProcessThread type, 432

inheritance, 146, 155

ProcessStartInfo, System.Diagnostics

polymorphism, 147, 162

namespace, 428

pixel unit of measure, GDI+, 660

ProcessThread, System.Diagnostics namespace,

Platform Invocation Services (PInvoke), 6

428

pointer types and operators

ProcessThread type, 432

& operator, 312–13

ProcessThreadCollection, System.Diagnostics

* operator, 312–13

namespace, 428

> operator, 314

ProductName property, Application class, 609

example, swap function, 313

ProductVersion property, Application class, 609

field access, 314

programming. See historical overview of

table of operators, 310

programming

Point(F) type, System.Drawing namespace,

properties

651–52

adding to custom controls, 741–44

polygons, GDI+, 688, 690

common intermediate language (CIL),

polymorphism

494–95

abstract classes, 164, 166

internal representation, 152–53

abstract methods, 166–69

PropertyBuilder, System.Reflection.Emit

description, 147

namespace, 505

method hiding, 169–70

PropertyInfo class, System.Reflection

override keyword, 163–64

namespace, 396

overview, 162

protected access modifier, 77

virtual keyword, 163–64

protected internal access modifier, 77

portType element, WSDL document elements,

protected keyword, 158

938–39

provider factory model, ADO.NET, 770–72

Position, Stream class, System.IO, 532

proxies and messages, remoting, 567–68

POST data type, 940

proxy code using Visual Studio 2005, XML web

PreInit, ASP.NET Page events, 862

services, 947–48

preprocessor directives, 289, 316–19

Proxy( ) method, SoapHttpClientProtocol class,

PreRender, ASP.NET Page events, 862

945