P/Invoke
calling unmanaged code with P/Invoke, 141
COM Interoperability, compared to, 144
embedding binary data in assembly, 95
IJW, compared to, 142
performance issues, 264
page faults
hard page faults, 278
soft page faults, 278
pages
memory management, 276
Paint event
event architecture, 416
execution order, 421
Windows Forms, 420
parameterized constructor
IL reference types, 76
IL value types, 72
partitions, CLI
Partition I Architecture, 119
Partition II Metadata, 119
Partition III CIL, 140
Partition IV Library, 119
Partition V Annexes, 119
passing by reference, 47
issues with terminology, 47
local variables, 48
managed pointers, 47
programming IL, 46
using Idarg commands, 50
using Idlnd commands, 51
using Idloca commands, 49
using stind commands, 52
PE files, 169
advantage, 159
COFF files, 159
COFF header, 160
DumpBin.exe, examining contents using, 174
file structure, 162
CLR header, 163
IL code, 163
manifest file, 163
metadata, 163
metadata tables, 166
prime module, compared to other modules, 162
version robustness, 167
image files, 159
managed resources, 169
PE header, 160
data directory table, 160
IMAGE_DIRECTORY_ENTRY_C OM_DESCRIPTOR field, 164
Subsystem flag, 176
PE signature, 160
unmanaged resources, 169
PerfMon, 288
_Global_ instance, 289
customizing counters, 288
CustomPerfCounter example, 295
performance object, 289
System Monitor, 288
Task Manager, compared to, 288
performance, 237
.NET Framework, 238
comparing languages, 239
garbage collector, 241
performance advantages of .NET, 241
compared to responsiveness, 237
GDI compared to GDI+, 448
improving using weak references, 231
interoperability issues, 240
JIT compiler, 243
managed code
comparing languages, 239
managed compared to unmanaged code, 238
issues to consider, 240
ngen.exe, 247
optimizing performance, 259
avoid late binding, 266
avoid overempasis on performance, 259
avoid Visual Basic 6 constructions in Visual Basic .NET, 269
crossing boundaries, 264
looping, 262
minimizing virtual memory requirements, 270
obfuscators, 259
string types, 263
StringBuilder class, 260
using C++, 270
value types, 265
reference counting, problems with, 209
storing IL binary code in assembly, 165
unmanaged code
comparing languages, 240
performance counters, 287
.NET performance counters, 290
coding with, 291
CustomPerfCounter example, 294–97
definition, 274
MonitorUseResource example, 293–94
PerformanceCounter class, ease of use with, 287
profilers, compard to, 275
profiling API, compared to, 305
performance monitoring
need for, 273
PerfMon, 288
performance counters, 287
Task Manager, 287
PerformanceCounter class
BeginInit() method, 292
EndInit() method, 292
NextValue() method, 292
PerfMon, using with, 296
performance counters, ease of use with, 287
System.Diagnostics, 291
PerformanceCounterCategory class
Create() method, 296
Exists() method, 296
Getlnstances() method, 292
System.Diagnostics, 287
permission sets, CLR security
calling Strong-Named Assemblies, 469
Everything, 468
FullTrust, compared to, 468
partially trusted code, application in, 468
Execution, 467
FullTrust, 469
Everything, compared to, 468
Internet, 468
Locallntranet, 467
Security permission, 477
mscorcfg.msc configuration tool, setting using, 488
Nothing, 467
partially trusted code, 470
SkipVerification, 467
permissions
asserting permissions, 491
AuditingLightDetector sample, 491–92
CLR permissions, 466
custom permissions, 478
LightDetector sample, 479–91
FileIO permission, 461
multiple assemblies
assert, 459
demand, 459
deny, 460
PermitOnly, 460
PermissionSet class, 472
Security permission, 461
Allow Calls to Unmanaged Code permission, 462
Assert any permission which has been granted permission, 463
Enable Code Execution permission, 462
inperative security, 471
Skip Verification permission, 462
PermissionSet class
stack walk modifier, 472
PermissionState enumeration
None value, 481
System.Security.Permissions, 481
Unrestricted value, 481
PermitOnly() method
CodeAccessPermission class, 471
peverify.exe
debugging compile-time IL errors, 60
problems with boxing, 83
System.Reflection.Emit classes, use of in, 322
verification of code, importance in, 139
PGP
certification authorities, 514
pinned objects
garbage collector performance issues, 210
pinvokeimpl keyword
.method directive, 91
calling unmanaged type, 147
compared to DllImportAttribute class, 91
execution context, 141
PKCS #7 certificate, 514
plain text
cryptography, 498
Point structure
System.Drawing, 123
Portable Executable files, see PE files, 158
preservesig keyword
.method directive, 113
prime module
other modules, compared to, 162
structure, 162
Priority property
Thread class, 344
PriorityLevel property
ProcessThread class, 344
private key
assemblies, use in, 177
asymmetric encryption, 504
delay-signing an assembly, 513
lost or stolen key
certificate security issues, 517
private keyword
.class directive, 33
privatescope keyword
keywords for type members, 35
Process class
System.Diagnostics, 343
Threads property, 343
ProcessThread class
compared to Thread class, 338
PriorityLevel property, 344
System.Diagnostics, 343
ThreadState property, 344
profilers, 274
allocation profiler, 304
alternative techniques as replacement, 297
choosing, 297
Compuware profiler, 303
debug builds, 275
lack of integrated profiler in .NET, 297
performance counters, compard to, 275
profiling API, 305
profiling timer code, writing, 298–302
release builds, 275
profiling API, 305
performance counters, compared to, 305
properties
accessing fields compared to accessing properties, 251
get and set accessor methods for property, 68
IL value types, 67
viewing native code for accessing property, 257
wrapping field in property, 67
protected code
thread synchronization, 357
pseudo-custom attributes, 102
DllImportAttribute class, 102
unmanaged metadata API, 102
pt
Windows message, 417
public key
assemblies, use In, 177
asymmetric encryption, 504
delay-signing an assembly, 510
public keyword
.class directive, 33
Put() method
ManagementObject class, 407