
Pro CSharp And The .NET 2.0 Platform (2005) [eng]
.pdf
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 |




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 |



■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 |