Visual CSharp 2005 Recipes (2006) [eng]
.pdf560 ■I N D E X
TCP client |
threads, 95–96 |
template for, 362–363 |
creating a thread-safe collection instance, |
TCP server |
134–138 |
template for, 360–362 |
executing a method |
TcpClient class |
asynchronously, 99–107 |
System.Net.Sockets namespace, 359 |
at a specific time, 109–111 |
TcpListener class |
by signaling a WaitHandle class, 111–113 |
AcceptTcpClient method, 360, 363–364 |
periodically, 107–109 |
BeginAcceptTcpClient method, |
using new thread, 113–115 |
363–364 |
using ThreadPool class, 96–99 |
EndAcceptTcpClient method, 364 |
knowing when a thread finishes, 130–132 |
System.Net.Sockets namespace, |
synchronizing access to shared data, 128–130 |
359, 363 |
synchronizing execution of multiple threads |
templates |
using a Monitor, 115–120 |
XSL stylesheets, 210 |
using a Mutex, 124–126 |
temporary files, 169–170 |
using a Semaphore, 126–128 |
text files, reading and writing, |
using an event, 120–124 |
156–158 |
terminating execution of thread, 132–134 |
Text property |
ThreadStart class |
Form class, 244 |
System.Threading namespace, 113 |
Text value |
ThreadStart delegate, 113 |
CommandType enumeration, 312 |
ThreadState class |
TextBox class |
Running method, 113 |
configuring context menu for, 239 |
ThreadState enumeration |
finding all instances on a form, 219 |
System.Threading namespace, 113 |
restricting input, 229–231 |
ThreadStateException class |
TextBox control |
System.Threading namespace, 113 |
KeyPress event, 231 |
thumbnails |
providing input error for with ErrorProvider |
showing for image, 273–275 |
component, 250 |
TickCount property |
TextChanged event |
Environment class, 500 |
ComboBox control, 232 |
TimedOut value |
TextReader class |
IPStatus enumeration, 357 |
System.IO namespace, 72 |
Timeout class |
TextWriter class |
Infinite property, 108–109 |
System.IO namespace, 72 |
System.Threading namespace, 108 |
Thread class |
Timeout property |
Abort method, 83, 132 |
SmtpClient class, 352 |
creating and controlling threads, 113 |
WebRequest class, 344 |
creating new object, 113 |
Timer class, 110 |
CurrentPrincipal property, 415, 418 |
Change method, 108 |
CurrentUICulture property, 243 |
Dispose method, 108 |
IsAlive property, 131 |
periodic execution of methods, 108 |
Join method, 131 |
System.Threading namespace, 107, 109 |
ResetAbort method, 132 |
System.Timers namespace, 107, 513 |
Start method, 113, 132 |
System.Windows.Forms namespace, 107 |
System.Threading namespace, 415 |
TimerCallback delegate, 108 |
thread synchronization, 116 |
System.Threading namespace, 107, 109 |
thread-safety |
times. See dates and times |
testing for with IsSynchronized property, |
TimeSpan structure, 110 |
134 |
add, subtract and compare dates and times, |
ThreadAbortException class, 132 |
49–51 |
ExceptionState property, 132 |
operators supported by, 49 |
System.Threading namespace, 132 |
System namespace, 108, 389 |
ThreadPool class |
Title property |
GetAvailableThreads method, 99 |
Console class, 29 |
QueueUserWorkItem method, 97 |
Tlbexp.exe, 455 |
RegisterWaitForSingleObject method, |
Tlbimp.exe, 277, 451 |
111 |
To property |
SetMaxThreads method, 99 |
MailMessage class, 353 |
■I N D E X 561
ToArray method |
unary negation (-) operator |
ArrayList class, 52 |
supported by TimeSpan and DateTime |
MemoryStream class, 36 |
structures, 50 |
Queue collection, 52 |
unary plus (+) operator |
Stack collection, 52 |
supported by TimeSpan and DateTime |
ToBase64CharArray method |
structures, 50 |
Convert class, 38 |
UnauthenticatedPrincipal value |
ToBase64String method |
PrincipalPolicy enumeration, 416 |
Convert class, 38 |
Undo method |
ToBoolean method |
WindowsSecurityContext class, 419 |
BitConverter class, 36 |
Unicode property |
ToInt32 method |
UnicodeEncoding class, 34 |
BitConverter class, 36 |
Unicode string |
tools, 1 |
Base64 encoding and decoding using |
TopIndex property |
Convert class, 38 |
ListBox class, 228 |
UnicodeEncoding class |
TopMost property |
BigEndianUnicode property, 34 |
Form class, 442 |
GetEncoding method, 34 |
ToString method |
Unicode property, 34 |
BitConverter class, 38, 427–428 |
Unload method |
IFormattable interface, 484 |
AppDomain class, 83 |
Object class, 410 |
unmanaged code interoperability, 439 |
PhysicalAddress class, 337 |
calling a function in an unmanaged DLL, |
SecureString class, 432 |
439–442 |
StringBuilder class, 31 |
calling an unmanaged function that uses |
TotalFreeSpace property |
a callback, 447–448 |
DriveInfo class, 171 |
calling an unmanaged function that uses |
Trace class |
a structure, 444–447 |
System.Diagnostics namespace, 15 |
exposing .NET component through COM, |
Transaction property |
455–456 |
command objects, 312 |
releasing COM components quickly, 452–453 |
Transform method |
retrieving handles for controls, Windows or |
XslCompiledTransform class, 209 |
files, 442–444 |
TransparentKey property |
retrieving unmanaged error information, |
Form class, 264 |
448–450 |
TreeNode class, 154 |
using ActiveX controls in .NET clients, |
System.Windows.Forms namespace, 183 |
454–455 |
Tag property, 217 |
using COM components in .NET clients, |
TreeView control |
450–452 |
BeforeExpand event, 154 |
using optional parameters, 453–454 |
Fill method, 154 |
unmanaged errors |
showing a JIT directory tree, 154–156 |
retrieving information, 448–450 |
showing XML document structure, 183–187 |
unmanaged functions |
Type class |
calling function that uses a callback, |
EmptyTypes field, 88 |
447–448 |
GetConstructor method, 87–88 |
using structure parameters, 444–447 |
Missing field, 453 |
Unprotect method |
System namespace, 52, 319 |
ProtectedData class, 435 |
type information |
ProtectedMemory class, 435 |
retrieving, 83–85 |
SectionInformation class, 309 |
Type Library Exporter. See Tlbexp.exe |
Unregister method |
Type Library Importer utility. See Tlbimp.exe |
RegisteredWaitHandle class, 111 |
typeof operator |
Up value |
determining whether control is TextBox, 219 |
OperationalStatus enumeration, 337 |
■U |
uploading methods |
WebClient class, 343 |
|
UDP |
Url class |
communicating with, 371–374 |
System.Security.Policy namespace, 408 |
UdpClient class |
Url property |
System.Net.Sockets namespace, 371 |
WebBrowser control, 254 |
■I N D E X 563
WebClient class |
creating an immovable form, 244 |
CancelAsync method, 342 |
displaying a web page, 254–256 |
Certificates property, 350 |
drag-and-drop operations, 251–252 |
Credentials property, 350 |
finding all MDI child forms, 223–225 |
data download methods, 341 |
forcing a ListBox to scroll to most recently |
OpenRead method, 344 |
added item, 228–229 |
System.Net namespace, 341, 344 |
laying out controls automatically, 238–239 |
uploading methods, 343 |
linking data to a control, 216–218 |
WebException class |
making a borderless form movable, 244–247 |
System.Net namespace, 344 |
multilingual forms, 241–244 |
WebPermission class, 401 |
process all controls on form, 218–220 |
System.Net namespace, 400 |
restricting TextBox class input, 229–231 |
WebPermissionAttribute class, 401 |
saving configuration settings for forms, |
WebRequest class |
225–228 |
Certificates property, 349 |
sorting a ListView by column, 235–238 |
ClientCertificates property, 376 |
tracking visible forms in application, 220–223 |
Create method, 344 |
using part of a main menu for a context |
Credentials property, 349–350, 376 |
menu, 239–240 |
GetResponse method, 344 |
validating an input control, 248–250 |
System.NET namespace, 72, 344, 349, 376 |
Windows groups, determining membership of, |
Timeout property, 344 |
411–414 |
WebResponse class |
Windows integration, 499 |
GetResponseStream method, 344 |
accessing runtime environment information, |
System.NET namespace, 72, 344, 349 |
499–503 |
WellKnownObjectMode enumeration |
creating a shortcut on Desktop or Start |
System.Runtime.Remoting namespace, 385 |
menu, 518–520 |
values, 385 |
creating a Windows service, 511–516 |
wildcard expression |
creating a Windows service installer, 516–518 |
finding files that match, 163–164 |
reading and writing to the Windows registry, |
Win32 API |
505–508 |
core libraries, 440 |
retrieving the value of environment variable, |
LogonUser function, 419 |
503–504 |
Win32 API functions |
searching the Windows registry, 508–511 |
using for writing and reading INI files, 440 |
writing an event to the Windows event log, |
Win32 CryptoAPI |
504–505 |
CryptGenRandom function, 421 |
Windows registry |
Win32Exception class |
reading and writing to, 505–508 |
System.ComponentModel namespace, 136 |
searching, 508–511 |
Win32_Printer class |
Windows service, creating, 511–516 |
methods, 298 |
Windows Service Control Manager. See SCM |
Pause method, 295 |
Windows service installer |
Resume method, 295 |
creating, 516–518 |
Win32_PrintJob class |
WindowsBuiltInRole enumeration |
Pause method, 295 |
System.Security.Principal namespace, 412 |
querying, 295 |
values, 413 |
Resume method, 295 |
WindowsIdentity class |
WinAPI functions, 442 |
GetCurrent method, 411–412 |
WindowHeight property |
Impersonate method, 418–419 |
Console class, 29 |
implements IIdentity interface, 412 |
Windows application |
System.Security.Principal namespace, 411, |
creating from command line, 4–5 |
418 |
example, 5–7 |
WindowsPrincipal class |
Windows event log |
implements IPrincipal interface, 412 |
writing an event to, 504–505 |
IsInRole method, 411–412 |
Windows forms, 213 |
System.Security.Principal namespace, 411 |
adding a control programmatically, 214–216 |
WindowsPrincipal value |
animated system tray icon, 247–248 |
PrincipalPolicy enumeration, 416 |
autocomplete Combo Box, 232–234 |
WindowsSecurityContext class |
classes, 213 |
System.Security.Principal namespace, 419 |
context-sensitive help, 252–253 |
Undo method, 419 |