early binding (COM), 1155
#elif preprocessor directive, 71–72
#else preprocessor directive, 71–72
EnableVisualStyles method (Application class), 785–786
#endif preprocessor directive, 71–72
EndOfStreamException class, 329
EndReceive() method (MessageQueue class), 1111
#endregion preprocessor directive, 72–73
Enterprise Services
automatic transactions, 1068, 1078
business service layer for, 1067
client application, 1077–1078
Component Services explorer for, 1075–1077
contexts and, 1067–1068
current issues, 1126
data service layer for, 1067
defined, 1065
deployment, 1073–1075
distributed transactions, 1068
history of, 1066
installer packages for, 1074–1075
loosely coupled events, 1069
Microsoft Application Center Server and, 1067
object pooling, 1068
overview, 1065–1069
presentation service layer for, 1067
queued components, 1069
role-based security, 1068
sample application, 1080–1090
ServiceConfig class, 1090–1091
ServiceDomain class, 1090, 1091
services without components, 1069, 1090–1093
simple COM+ application, 1070–1073
transactions, 1068, 1078–1080
WCF and, 1146–1147
enumerations (enums)
benefits of using, 56
collection enumerators, 246–247
converting from a string, 57
defining, 55, 56
described, 55
EnumFontFamilies example, 878–880
FileStream class, 1208
instantiated as structs, 57
for messages in message queues, 1109–1110
retrieving string representations, 57
retrieving values, 57
TimeOfDay example, 56
enumerators for collections, 248
EnumFontFamilies example, 878–880
Equals() method
comparing reference types for equality, 146–147
comparing value types for equality, 147, 148
described, 107
overriding for comparisons, 146–147, 148
overriding for dictionaries, 264, 266, 267
static version, 147
virtual version, 146–147
equals sign (=)
as assignment operator, 34, 134–135
as comparison operator (==), 48, 134–135, 147
error handling. See also exceptions
catch blocks, defined, 330
catching exceptions from other code, 336–337
catching exceptions from predefined classes, 330–340
catching user-defined exceptions, 341–343
choosing exception type to throw, 334–335
for code access permissions, 472
COM, 1158
defining your own exception classes, 346–348
exceptions for, 16–17
exceptions not handled and, 338
finally blocks, defined, 330
handling different exceptions in different places, 340
modifying the type of exception, 340
multiple catch blocks for, 331, 332–336
nested throw statements for, 332
nested try blocks for, 338–340
for overflow and array out-of-bounds, 331–332
process for, 330
for releasing database resources, 586, 587–588
SimpleExceptions class, 333–336
syntax, 330–331
SystemException properties for, 337
throwing an exception, defined, 331
throwing user-defined exceptions, 343–346
for thrown SecurityException, 480, 482, 492
try blocks, defined, 330
for Windows Forms controls, 767–769
#error preprocessor directive, 72
ErrorProvider component (Windows Forms)
clearing, 768
overview, 767–768
using one error provider per form, 768–769
escape sequences
for regular expressions, 236, 238–240
searching for escape meta-characters, 240
table summarizing, 44, 239
EvaluateException, 807
event logging for services
adding for other application types, 1305–1306
adding for service classes derived from
ServiceBase, 1302, 1305
adding to QuoteServer, 1306–1307
architecture, 1304
AutoLog property of ServiceBase class for, 1302, 1305
classes, 1305
creating an event log listener, 1307–1308
custom event logging, 1303
example log entry, 1302–1303
trace messages and, 1307
event sink library (.NET Remoting), 1059–1060
EventArgs class, 188–189, 832
event-booking application
AddEvent() method, 995
adding events to the database, 931–933
ADO.NET and data binding for, 926–933
Application_Start() event handler, 994
attendeeList control, 928
Attendees table, 926–927
binding to controls on the Web page, 999
binding to the database, 927–928
calendar_DayRender() event handler, 930–931
calendar_SelectionChanged() event
handler, 930
client for Web service extension, 997–1001
code-behind file, 929–930
creating the Web site, 920–921, 926
customizing the calendar control, 928–931
data binding for client application, 1000
data display with templates, 935–939
database for, 926–927
DataList control, 937–938
DataSet objects with Web services, 997
declaring objects needed for database access, 995–996
deleting data sources for client application, 998
event list display, 933–935
EventList control, 936–937
EventList_SelectedChanged() method, 1001
Events table, 927
ExecuteNonQuery() method, 932–933
extracting event data, 930
form for, 920–923
FormView control, 936, 937–938
GetData() method, 994–995
GetFreeDate() method, 929–930, 933
GridView control, 933–934
Label control, 920
Lock() and Unlock() methods, 996
MRBEventData control, 929
MRBService service, 994–995
Page_Load() event handler, 924
queryResult with, 996–997
resultLabel control, 924
results of a submission, 924–925
roomList control, 928
Rooms table, 927
SqlDataSource controls, 927–928
storing the DataSet for client application, 998–999
submitButton_Click() event handler, 924, 931–932, 934, 1000–1001
using statements, 995
ValidationSummary control, 921
Web server controls for, 921–924
Web service for, 993–997
web.config file, 993
EventHandler delegate, 186–188
EventHandler<TEventArgs> generic delegate, 302–303
EventList control, 936–937
EventLog component, 1307–1308
events
Click event example, 186–188
COM event handling, 1158, 1166–1168, 1181–1182
as data members of classes, 85
defining, 188
delegates for, 185
described, 85
focus, gaining and losing for controls, 761
generating, 188–192
keyboard events, 760–761
messages wrapped in, 185
methods for handling, 186–188
mouse events, 760
names of event handlers, 187
.NET Remoting and, 1056–1062
receiver's view of, 185–188
senders for, 185–186, 188
threading workaround using, 350
user control event handler, 797–798
for user controls (ASP.NET), 948
for Windows Form user interaction, 760–761
Windows Services event logging, 1302–1308
exceptions. See also error handling
for aborting threads, 354
base class exception classes, 328–330
catching from predefined classes, 330–340
catching user-defined exceptions, 341–343
choosing type to throw, 334–335
class hierarchy, 329–330
debugging and, 406–407
handling different exceptions in different places, 340
modifying the type of, 340
multiple catch blocks for, 331, 332–336
nested throw statements for, 332
in .NET, 16–17
not handled, outcome of, 338
SimpleExceptions class, 333–336
throwing, defined, 331
throwing from catch and finally blocks, 339
throwing user-defined exceptions, 343–346
user-defined exception classes, 340–348
ExecuteNonQuery() method, 591, 932–933
ExecuteReader() method, 591–592
ExecuteScalar() method, 592–593
ExecuteXmlReader() method, 593–594
Exists() method (MessageQueue class), 1104–1105
explicit type conversions, 142–145, 158. See also
user-defined casts
exposing Web services, 987–990
extern modifier, 125
extracting characters from strings, 224