C# basics, 1621–1652
arrays, 58–59, 1634
Boolean types, 43–44
built-in reference types, 45
built-in value types, 41
character types, 44–45
comments, 68–71
compiling C# files, 64–66
conditional statements, 47–51
console I/O, 66–68
constants, 38–39
constructors, 1630–1631
control statements, 1634–1636
CTS types, 41
decimal types, 43–44
enumerations, 55–58, 1627
events, 1647–1649
exception handling, 1639–1640
fields, 81
floating-point types, 42–43
flow control, 47
generics, 1649–1651
identifier rules, 74–76
inheritance, 1640–1642
integer types, 41–42
interfaces, 1626
jump statements, 55–56
loops, 51–55, 1637–1638
Main( ) method, 62–64
method parameters and return types, 1628
methods, 80–81, 1627
namespace aliases, 61–62
namespaces, 59–60, 1622–1623
naming conventions, 77–80
object type, 45–46
overview of, 29, 1621–1622
parameter modifiers, 1628–1630
preprocessor directives, 71–74
properties, 80–81, 1631–1632
reference types, 39–41, 1623–1624
resource management, 1642–1647
simple example program, 30–33
static members, 1633–1634
string type, 46–47
summary, 81–82
usage conventions, 76–77
using statement, 60–61
value types, 39–41, 1624–1625
variable declaration, 34
variable initialization, 34–35
variable scope, 36–38
C# class, writing, 493–495
C++/CLI programming language, 1621–1652
arrays, 1634
constants compared with C#, 38
constructors, 1630–1631
constructors compared with C#, 99
control statements, 1634–1636
data types compared with C#, 42
enumerations, 1627
error handling compared with C#, 372
events, 1647–1649
exception handling, 1639–1640
GDI+ drawing principles, 1075
generics, 1649–1651
inheritance, 1640–1642
inheritance compared with C#, 113
interfaces, 1626
loops, 1637–1638
memory management compared with C#, 319–320
method parameters and return
types, 1628
methods, 1627
mixing native and managed code, 1651–1652
namespaces, 1622–1623
nondeterministic destruction, 855
overview of, 1621–1622
parameter modifiers, 1628–1630
pointers compared with C# references, 40
properties, 1631–1632
reading/upgrading Visual Studio 6 projects, 411
reference types, 1623–1624
resource management, 1642–1647
static members, 1633–1634
value types, 1624–1625
variable initialization compared with C#, 35
writing C++/CLI class, 486–490
Cab Project, Visual Studio 2005 installer projects, 447
cache, Active Directory, 1603
Calculate DocumentSize( ) method, 1116, 1118–1119
CalculateLineWidths( ) method, 1116, 1118–1119
calendar control, 1239–1242
call contexts, remoting and, 1450–1452
callback functions, 195.
See also delegates
CallExternalMethodActivity, 1547, 1578
camel casing, for names, 77
Canvas panel, 1154–1155
CapsEditor application, 1112–1126
calculating item and document sizes, 1118–1119
coordinate transforms, 1121–1122
editing text document in, 1112–1116
Invalidate( ) method, 1116–1117
OnPaint( ) method, 1119–1120
responding to user input, 1122–1126
captures, regular expressions, 239–241
cascading style sheets. See CSS (cascading style sheets)
case
casing schemes for names, 77–78
sensitivity in C#, 32
switch…case statement, 50–51
caspol.exe (Code Access Security Policy tool), 592–594
changing group permissions, 619–620
creating code groups, 618
creating/applying permission sets, 620
deleting code groups, 619
distribution with strong names, 622–623
exception checking function, 594
options, 592
resetting security policy, 618
viewing assembly code groups, 595–597
viewing assembly permissions, 600
viewing code groups with, 592–594
viewing enterprise level permissions, 603
viewing user level permissions, 602
cast operators
boxing and unboxing, 188
casting between pointer types, 335
casts between classes, 185, 187
COM interface for, 751
implementing user-defined casts, 182–185
list of, 156
multiple operators, 189–192
overloading, 180
overview of, 181–182
pointers to integer types, 334–335
summary, 193
CatalogZone control, 1291, 1294–1295, 1298
catch blocks
catching exceptions, 374–376
catching exceptions from other code, 380–381
consequences of unhandled exceptions, 382
multiple, 376–380
throwing exceptions from, 383
user-defined exceptions, 385–387
Visual Studio 2005 exception handling, 430
CCWs (COM callable wrappers), 771, 775–776
Cert2spc.exe (Software Publisher Certificate Test tool), 624
certificates, code distribution with, 623–630
change notification, in replication, 1588
ChangePassword control, ASP.NET, 1281, 1282–1283
<channel> element, 1431
ChannelFactory class, proxy for accessing services, 1536–1537
channels
defined, 1402–1403
delayed loading of client, 1434–1435
formatters, 1415
overview of, 1410–1414
registering with ChannelServices, 1415–1416
security configuration of, 1442–1444
sending messages to, 1420
ChannelServices
defined, 1402
registering with, 1415–1416
char type, 1625
character types, 44–45
CheckBox control, 1000
checked operator, 159–160
CheckedChanged event, check box, 1000
CheckedListBox, 1001–1003
Children property, object collections, 1601
class ID (CLSID), 751, 778
class keyword, declaring reference type in C#, 1623
Class Library Wizard, writing Visual Basic class assembly, 490
Class View window, Visual Studio 2005, 420
classes
abstract, 117
adding constructors to a class hierarchy, 120–122
ADO.NET database, 849–851
ADO.NET shared, 849
AJAX OOP extensions, 1326–1327
assigned with using keyword, 61
bit arrays, 311
between casts, 185, 187
constructors of derived classes, 118–120
culture classes, 638
data members, 85
DataGridView hierarchy, 1049–1052
delegates implemented as, 197
dictionaries, 305–306
event logging, 534–535
exception handling, 372, 378–379, 390–392
font, 1109
function members, 85–86
inheritance and, 112–113
instances of, 84
IP address, 1359–1360
lifetime management of, 1427
lower-level protocols, 1361–1371
members, 84–85
Microsoft.SqlServer.Server namespace, 957–958
namespaces, 21
namespaces for grouping, 32
object class, 106
object creation and, 84
objects as instance of, 197
partial, 104–105
passing objects in remote methods, 1421–1422
performance monitoring and, 542
printing, 1126–1127
reflection, 358
sealed, 117–118
static, 105–106
System namespaces and, 60
System.DirectoryServices, 1594–1595, 1616
System.Xml, 903, 906
System.Xml.XPath, 921, 923–927
transaction, 677–680
TriggerAction, 1189
Windows Forms hierarchy of, 993–995
WPF hierarchy of, 1140–1141
XmlNode, 914–915
XmlReader and XmlWriter, 906–907
classes, generic, 243–268
binary code reuse, 246
code bloat and, 246
collections, 269–270
constraints, 252–255
creating, 247–251
default values, 252
inheritance and, 255–256
invoking methods, 251–252
naming conventions, 246–247
overview of, 243–244
performance benefits of, 244–245
static members, 256
summary, 268
type safety and, 245
classes, .NET
base class library, 20
connection, 851
folders and files, 791–793
.NET Remoting, 1440
Registry, 831–834
Registry, example of, 834–840
serialization and, 789
classSchema, 1585, 1589–1590
CLI. SeeC++/CLI programming language
Click events, buttons, 998–999
ClickOnce, 459–462
application cache, 461
compared with Windows Installers, 459–460
overview of, 443, 459
publishing applications with, 460
security, 461
settings, 461
<client> element, 1433
ClientActivated_Client. config file, 1433
ClientCallback, duplex communication, 1539–1540
client.exe.config file, 1434, 1449
clients
accessing new service, 731
client application for DatabaseResourceReader, 673
COM components used from.NET clients, 755
creating COM client, 779–782
deployment solution, 448–456
duplex communication between service and, 1538–1540
error messages, 1319
JavaScript references, 1318
proxy to access services, 1536–1537
requirements for .NET applications, 443–444
tiered development and, 894–895
WCF, 1520–1522
Web Server deployment of, 458
clients, .NET Remoting
channels, 1412
code using configuration files, 1434
configuration file, 1449
configuration for client-activated objects, 1433
configuration for well-known objects, 1432
delayed loading of client channels, 1434–1435
lifetime management for, 1426–1429
overview of, 1409–1410
security, 1442–1444
ClientSponsor class, 1427
clipping region, using for graphics, 1080–1082
ClipRectangle property, PaintEventArgs, 1081
Clone( ) method
copying arrays, 141–142
transactional resources, 702
Close( ) method
block statement and, 855–856
hosting, 1535
service host, 1517
service implementation, 1531
closed locked state, state machine workflows, 1565–1568
closed unlocked state, state machine workflows, 1566–1568
CLR (Common Language Runtime), 4–7
application deployment and, 444
code access permissions, 597–598
generics and, 243
identity permissions, 598
language interoperability, 5–7
managed code and, 4
Object Remoting, 1400, 1401
overview of, 4
performance improvement, 5
platform independence, 4–5
runtime versions, 518–519
support for code access security, 603–604
CLS (Common Language Specification)
language interoperability and, 12–13, 485–486
requirements for CLS-compliance, 495–497
writing C# class assembly, 493–495
writing C++/CLI class assembly, 486–490
writing Visual Basic class assembly, 490–493
CLSCompliant attribute, 496
CLSID (class ID), 751, 778
code
accessing resources from, 1165–1166
applying themes to pages, 1285
ASP.NET model, 1219–1220
binary code reuse, 246
distribution with certificates, 623–630
distribution with strong names, 622–623
generating with XSD, 882–887
mixing native and managed, in C++/CLI, 1651–1652
writing to create data tables, 875–876
code access security, 590–632
asserting permissions, 610–612
caspol.exe utility, 592–594
changing code group permissions, 619–620
CLR support for, 603–604
code distribution with certificates, 623–630
code distribution with strong names, 622–623
code groups, 591
creating code access permission, 610–612
creating code groups, 618
creating/applying permission sets, 620
declarative security, 613
deleting code groups, 619
demanding permissions, 604–605
denying permissions, 610
implicit permission, 609
managing code groups and permissions, 617
managing security policies, 613–614
managing zones, 630–632
overview of, 14, 590–591
permissions and permission sets, 597–599
policy levels, 601–603
requesting permissions, 605–609
resetting security policy, 618
security configuration file, 614–617
summary, 636
turning on/off, 617–618
viewing assembly code groups, 595–597
viewing assembly permissions, 599–601
Code Access Security Policy tool. Seecaspol.exe (Code Access Security Policy tool)
code bloat, 246
code editor, Visual Studio 2005, 412–414
code groups
changing permissions, 619–620
creating, 618
deleting, 619
levels, 596
managing, 617
membership conditions, 591
overview of, 591
viewing assembly, 595–597
<codeBase> directory, configuring, 519–520
CodeCondition class, WF, 1545
collection interfaces, arrays, 145–146
collections, 269–318
bit arrays. See bit arrays
dictionaries. Seedictionaries
Generic namespace, 265
initialization, 1699–1700
interfaces and types, 269–271
linked lists, 290–296
lists.See lists
List<T> class, 245
of multiple objects, 133
overview of, 269
performance, 317–318
queues, 283–287
read-only, 282–283
sorted lists, 297–299
stacks, 287–289
colors
form, 1021
graphic display modes and safety palette, 1097
named, 1096–1097
overview of, 1095–1097
RGB values, 1096
systemwide resources for, 1165
columns. See data columns
COM (Component Object Model)
COM apartments for threading, 581
creating COM client, 779–782
extending COM components for .NET applications, 764–767, 780–781
language interoperability and, 7, 485
.NET and, 748
registry used for component configuration, 509
releasing COM objects, 763
using COM component from .NET client, 755–761
Visual Basic integration with, 6
COM apartments, 581
COM callable wrappers (CCWs), 771, 775–776
COM Interoperability, 747–786
ActiveX controls in Windows Forms, 767–770
ASP.NET and, 770
attributes, 775–778
CCWs (COM callable wrappers), 771
connection points for extending COM components for .NET applications, 764–767, 780–781
creating COM clients, 779–782
creating COM components, 755–761
creating .NET components, 771–772
creating type library, 772–774
data types and, 751
error handling and event handling, 754
freeing memory, 749
interfaces, 749–751
marshalling mechanism, 755
metadata and, 748–749
method binding, 751
.NET and, 748
overview of, 747
platform invoke and, 783–785
primary interop assemblies, 764
RCWs (runtime callable wrappers), 761–763
registry configuration, 751, 778
running Windows Forms controls in Internet Explorer, 782–783
summary, 783–785
threading and, 752–753, 764
using COM component from .NET client, 755
wrapping Window API calls, 705
COM+
creating simple application, 1458–1461
deploying application, 1461–1463
Enterprise Services based on, 1453
history of, 1454–1455
transactional services. See Enterprise Services
Combine( ) method, Delegate class, 1646–1647
ComboBox control, 1001–1003
Command class, 1066
command link controls, Windows Vista, 1660–1661
command-line compiler (csc.exe)
adding resource files to assemblies, 652
compiling code with, 31
commands, database
calling stored procedures, 863–866
ExecuteNonQuery( ), 859
ExecuteReader( ), 860
ExecuteScalar( ), 861
ExecuteXmlReader( ), 861–862
overview of, 858
summary, 899
commands, with WPF, 1158–1161
comments, 68–71
internal within source files, 68–69
XML documentation, 69–71
Commit( ) method, transactions, 701
CommitChanges( ) method, Active Directory, 1603, 1605
CommittableTransaction class, 683, 685–687
committing phase, transactions, 677
Common Language Runtime. See CLR (Common Language Runtime)
Common Language Specification. See CLS (Common Language Specification)
Common subcomponent, message queues, 1486
Common Type System. See CTS (Common Type System)
communication channels, WCF, 1512
comparison operators
comparing equality of reference types, 170
list of, 156
operator precedence, 163
overloading, 178–180
types of, 178
compatibility, backward, 330
compilers, C#
conditional compilation, 72
csc.exe (command-line compiler), 31
options, 64–66
compiling projects, Visual Studio 2005 terminology, 423
component load balancing, Enterprise Services, 1455
Component Services Explorer
creating installer package with, 1462–1463
overview of, 1463–1465
ComponentCommands, WPF, 1158
components
colors known as, 1096
compared with assemblies, 478–479
ErrorProvider, 1004–1005
HelpProvider, 1005
ImageList, 1005
CompositeActivity, custom, 1557–1664
adding designer, 1559–1562
attached properties, 1562–1565
overview of, 1557–1559
Computer Management MMC snap-in
creating message queues, 1488–1489
message queue properties, 1489–1490
ComSvcConfig.exe utility, creating WCF façade, 1479–1481
concatenation operators, 157
concurrency, configuring with Component Services Explorer, 1465
condition types, in WF, 1545
conditional compilation
Conditional attribute and, 425
defined, 72
conditional operators, 156, 1635
conditional statements
if statement, 48–49
switch statement, 50–51
<configSections> setting, 1315
configuration
Active Directory, 1585–1586
application configuration files, 512–515
categories, 509–510
configuration files
application configuration files, 509, 512–515
.NET Remoting. See .NET Remoting, configuration files
security configuration file, 614–617
types of, 509–510
XML and, 509
<configuration>, ASP.NET AJAX, 1313–1316
Configure( ) method
client code using configuration files, 1434
implementing servers, 1447–1448
server code using configuration files, 1433–1434
Connect( ) method, 1420
connection points, extending COM components for .NET applications, 764–767, 780–781
connection strings
managing, 852–854
overview of, 852
connections, database, 851–857
creating in Visual Studio, 1058–1062
initiating transactions, 856–857
managing connection strings, 852–854
overview of, 851–852
releasing with try…catch…finally, 854–855
releasing with using block statement, 855–856
ConnectionsZone control, 1292
consistency, ACID properties, 677
consistent bit, transactions, 1468
Console Application project, Visual Studio 2005, 405–406
console windows, reading from/writing to, 66–68
Console.WriteLine( ) method, 221
AppendFormat( ) method, 227
format strings and, 228
how strings are formatted, 229–230
const keyword, 38
constants, 38–39
advantages of, 39
characteristics of, 38
defining class members, 85
constraints
defined, 849
foreign key, 879–880
generic classes, 252–255
naming conventions, 898–899
overview of, 878
primary key, 878–879
update and delete, 880–881
constructors, 94–99
adding constructors to a class hierarchy, 120–122
adding constructors with parameters to a class hierarchy, 122–124
in C#, Visual Basic and C++/CLI, 1630–1631
calling from other constructors, 98–99
constraints, 255
creating lists, 273
defining class functions, 86
of derived classes, 118–120
FileStream, 811
overview of, 94–96
passing data to threads, 555–556
static, 96–98
StreamReader class, 817
StreamWriter class, 818–819
for structs, 103–104
consuming Web services, 1381–1383
ContainerControl, 1023
Content controls, .aspx pages, 1270
ContentControl controls, WPF, 1148–1150
ContentPlaceHolder control, 1269–1270
Contents, ASP.NET server controls, 1220
<ContentTemplate>, UpdatePanel control, 1319–1320
context menus
attributes, 1068
providing type-safe access to data, 1063–1066
context-bound objects
marshal-by-reference classes as, 1421
overview of, 1405–1406
ContextMenuAttribute, 1066
ContextMenuStrip, 1015
contexts
Enterprise Services, 1455–1456
.NET Remoting, 1405–1406, 1450–1452
ContextUtil class, 1468
contiguous, hierarchical namespaces, 1587
continue statement, 56
contracts, WCF, 1522–1532
creating WCF façade, 1479
data contracts, 1524–1525
duplex communication, 1538–1540
message contracts, 1525–1532
overview of, 1522
service contracts, 1522–1524
Control Panel, Regional and Language options, 640
control statements, in C#, Visual Basic and C++/CLI, 1634–1636
controlName, ASP.NET Web server controls, 1220
controls, ASP.NET, 1220–1231
Crystal Reports Web server controls, 1224
custom, 1264–1268
data Web server controls, 1228–1229
example of server, 1231–1236
navigation and login Web server controls, 1231
overview of, 1220–1223
standard Web server controls, 1224–1227
user. See user controls, ASP.NET
validation Web server controls, 1229–1230
WebParts Web server controls, 1231
controls, Windows Forms
appearance, 996
Button, 998–999
CheckBox, 1000
ComboBox, ListBox and CheckedListBox, 1001–1003
Control class, 995–998
DateTimePicker, 1003
FlowLayoutPanel, 1010–1011
Label, 1005–1006
linking to data source, 1052
ListView, 1006–1008
MaskedTextBox, 1010
MenuStrip, 1015
miscellaneous functionality in, 998
overview of, 995
Panel, 1010
PictureBox, 1008
ProgressBar, 1008
RadioButton, 1000
RichTextBox, 1009–1010
size and location, 995–996
SplitContainer, 1011
TabControl and TabPages, 1012
TableLayoutPanel, 1010–1011
TextBox, 1009–1010
ToolStrip, 1012–1015
user interaction and, 996–997
Windows functionality for, 997–998
WPF, 1147–1152
within WPF applications, 1211–1212
controls, Windows Vista command link, 1660–1662
controls, WPF, 1147–1152
ContentControl controls, 1148–1150
HeaderedContentControl, 1150–1151
HeaderedItemsControl, 1152
ItemsControl, 1151–1152
layout, 1152–1157
simple controls, 1147–1148
using within Windows Forms, 1209–1210
Controls layer, AJAX Library, 1308
ControlTemplate, 1170–1174
ControlToValidate property, validation controls, 1229–1330
conversions, data type. Seetype conversion
ConvertAll( ) method
generic delegates with Array class, 262–264
List<T> class, 282
CookieContainer, exchanging data using SOAP headers, 1395–1396
coordinates, 1082–1087
drawing scrollable windows, 1092–1093
drawing shapes, 1077–1078
measuring, 1082
Point and PointF, 1083–1084
Rectangle and RectangleF, 1085–1086
Region, 1087
Size and SizeF, 1084–1085
transforms, 1121–1122
world, page and device, 1094–1095
copy constructors, 174
Copy Web tool, 442, 446
copying files, 799–804
core services layer, AJAX Library, 1307
correlation ID, acknowledgement queues, 1508
counters
adding PerformanceCounter components, 543–545
Performance Counter Builder, 542–543
Course Order sample application, 1499–1507
class library, 1499–1501
installation, 1510
message receiver, 1503–1507
message sender, 1501–1502
receiving results, 1507–1508
sending priority and recoverable messages, 1502–1503
transactional queues, 1508–1509
$create( ) function, AJAX Library, 1325
Create( ) method
programming message queues, 1490–1491
transactional message queues, 1509
WebRequest, 1343, 1356–1357
CREATE FUNCTION statement, SQL, 971–972
Create method, for XmlReader, 907
CREATE TABLE command, SQL, 975–976
CREATE TRIGGER command, SQL, 974
CREATE XML SCHEMA statement, SQL, 981–982
CreateChannel( ) method, Windows services, 1531
CreateGraphics( ) method, 1077
CreateInstance( ) method
activating client-activated objects, 1418
creating arrays, 140
returning proxy to client, 1419
CreateInstance( ) method, activators, 1428
CreateMessageSink( ) method, IChannelSender, 1414
CreateSink( ) method, formatters, 1415
CreateSubKey( ) method
RegistryKey class, 832–833
SelfPlacingWindow application using, 838–839
CreateUserWizard control, ASP.NET, 1281
Credentials property, WebRequest, 1344
CrossContextChannel, 1406
Crystal Reports Web server controls, 1224
csc.exe (command-line compiler)
adding resource files to assemblies, 652
compiling code with, 31
CSS (cascading style sheets)
Ajax core technology, 1302–1304
master pages in PCSDemoSite, 1272
optional in themes, 1284
CTS (Common Type System)
language interoperability and, 485–486
overview of, 10–12
predefined types and, 41
CultureInfo class, 663
System.Globalization, 639
cultures
changing programmatically, 663–664
classes in System.Globalization, 638
CurrentCulture and CurrentUICulture, 640–641
custom, 673–674
date formats, 643–644
number formats, 641–643
overview of, 639
sort order for, 648–650
specific, neutral, and invariant, 639–640
strong names and, 500
Windows Forms application as example, 644–648
CurrencyManager
creating by binding objects, 1056–1058
using with BindingContext, 1054–1056
CurrentCulture, 663
CurrentUICulture, 663
Custom Actions editor, Visual Studio 2005, 465–467
custom activities, WF, 1550–1552
custom attributes
AttributeUsage attribute, 351–353
GetCustomAttributes( ) method, 364–365
metadata and, 349
overview of, 350
parameter specification, 353–354
WhatsNewAttributes example, 354–358, 365–369
writing, 350–351
custom COM interfaces, 749
custom composite activities, WF, 1557–1565
custom controls, ASP.NET
calendar control, 1239–1242
defined, 1220
overview of, 1264–1268
custom controls, Windows Forms, 1023–1035
overview of, 1023–1024
TreeView-based, 1024–1030
user controls, 1030–1035
custom cultures, 673–674
custom indexers, 135
custom resource messages, 664–665, 697–698
custom resource readers, 669–670
custom services, 1577–1578
Cycle( ) method, ASP.NET custom controls, 1266–1267