C# Tips & Techniques

C# Tips & Techniques


$58.91 $61.00 Save 3% Current price is $58.91, Original price is $61. You Save 3%.
Choose Expedited Shipping at checkout for guaranteed delivery by Thursday, January 23
7 New & Used Starting at $1.99


Start using the powerful C# programming language and .NET platform immediately to develop and deploy enterprise-level solutions. Apply C# constructs to existing applications, or build programs quickly from scratch. Incorporating key features from C++ and Visual Basic, C# is a distinct object-oriented language designed to provide both powerful solutions and high productivity. Filled with hundreds of ready-to-run solutions you can use to build Web services and Windows applications, C# Tips & Techniques helps you leverage the power of Microsoft's .NET environment. Use this essential resource to gain a wealth of specific instructions to answer your questions, inform your work, and help you program more effectively.

Product Details

ISBN-13: 9780072193794
Publisher: McGraw-Hill/OsborneMedia
Publication date: 01/01/2002
Series: Tips and Techniques Series
Pages: 648
Product dimensions: 7.50(w) x 9.25(h) x 1.30(d)

Table of Contents

Part IThe .NET Environment and C#
Chapter 1Introduction to C# and .NET2
When to Use C# and C++8
Distinguishing .NET from Other Environments11
Using the Common Language Runtime13
Viewing Intermediate Language Code16
Taking Advantage of Just-In-Time Debugging18
Exploiting the .NET Interoperability with COM20
Using .NET Versioning to Handle Software Updates22
Querying Class Capabilities Through .NET Reflection24
Chapter 2Developing C# Applications Within Visual Studio .NET28
Using the Visual Studio Options Dialog Box34
Customizing Toolbars and Menus35
Adding Items to the Tools Menu38
Test Driving Visual Studio .NET41
Using the Properties Tool Window46
Using IntelliSense47
Getting Help49
Part IIThe C# Language
Chapter 3Getting Started with C#54
Accessing C# Library Classes60
Creating a Command Line Program61
Adding References to a Command Line Program64
Comparing the Results with C++65
Creating a Windows Program66
Comparing the Results with Visual Basic68
Understanding White Space and Tokens71
Commenting Your Code72
Documenting Your Code with XML Comments75
Using the C# Debugger75
Using the Output and Task List Windows78
Deciphering the Task List Window79
Writing and Using Your Own Namespaces80
Using the Console Class81
Formatting Output and Strings83
Using Preprocessor Directives87
Chapter 4Laying a C# Foundation90
Understanding Value Types98
Understanding References98
Writing Expressions102
Writing Statements103
Using Managed Code104
Using Logical Operators107
Using Relational, Equality, and Conditional Operators110
Using Assignment Operators113
Understanding C# Type Operators116
Using unsafe Code117
Using the sizeof Operator120
Boxing and Unboxing121
Using checked and unchecked Statements124
Writing Loops128
Using Program Control Statements132
Understanding Scope in C#138
Chapter 5Data Types in C#142
Defining Structures Within C#148
Declaring and Using Simple Data Types150
Creating Enumerated Lists152
Using Reference Types155
Basics of C# Classes156
Declaring Arrays in C#157
Understanding Interfaces158
Using Delegates to Create a Callback Function160
Using the object Data Type162
Passing Variables to Functions164
Using Fields and Properties166
Using String Interning to Reduce Memory Consumption171
Encoding Strings in C#172
Data Conversion in C#176
Chapter 6Structures in C#178
Defining Structures183
Using Structures as Value-Type Objects187
Using Structures as References188
Adding Functions to Structures190
Adding Properties to a Structure194
Chapter 7Understanding C# Classes200
Taking Advantage of Built-In Classes205
Referring to the Current Object Using the this Keyword213
Protecting Class Members Using Access Keywords215
Using Class Member Methods and Properties217
Using the static Modifier with Class Members223
Declaring Constructors and Destructors225
Creating Constants and readonly Fields231
Nesting One Class Within Another235
Overloading and Name Hiding238
Chapter 8Object-Oriented Programming and C#246
Encapsulating Your Data249
Inheriting from a Base Class251
Designing a Base Class255
Hiding Base Class Members256
Calling Constructors and Destructors in Order258
Preventing Inheritance--The Sealed Modifier260
Polymorphism: Changing Class Behavior Using Virtual Methods261
Using Virtual Properties273
Defining an Abstract Class275
Declaring an Abstract Function276
Using the Object Browser279
Setting the Browsing Scope280
Using the Objects Pane281
Using the Members Pane282
Navigating the Object Browser283
Searching for Symbols284
Chapter 9Handling Exceptions286
Using Exception Handling in the CLR290
Using try and catch Blocks292
Catching an Exception295
Using Multiple catch Blocks298
Using the Exception Classes300
Throwing an Exception303
Scope in Exception Blocks308
Using Exceptions with checked Variables309
Terminating a Program in an Exception Block311
Understanding the finally Block313
Chapter 10Advanced C# Concepts316
Nesting Namespaces321
Specifying Namespaces with the using Directive323
Taking a Closer Look at the using Statement326
Adding References327
Building a Module File331
Creating a Shared Assembly332
Using C# Interfaces to Define an Abstraction336
Getting Runtime Information Using Reflection340
Dynamically Invoking an Object344
Creating Threads of Execution346
Chapter 11Using Arrays352
Initializing an Array358
Using Multi-Dimensional Arrays360
Using Jagged Arrays364
Using the System.Array Class366
Searching and Sorting Arrays368
Using the Copy Method to Copy Array Values370
Using Arrays of Objects373
Using Indexers376
How Indexers Work377
Declaring an Indexer378
Using the C# Indexer Wizard379
Chapter 12File Operations382
Using the FileStream Class389
Using the MemoryStream Class to Create Temporary Storage392
Using the NetworkStream Class to Create a Network Connection395
Using the BufferedStream Class to Buffer a Stream's Input or Output399
Performing Asynchronous I/O401
Discarding Unnecessary Data Using the Null Field as a Bit Bucket404
Exploiting the TextReader and TextWriter Abstract Classes405
Using StreamReader and StreamWriter406
Opening a File Using the FileOpen Common Dialog410
Using the File and FileInfo classes414
Getting and Setting the Directory418
Part IIIWindows Programming in C#
Chapter 13Writing Windows Forms Applications424
Creating a Form-Based Application429
Hiding and Showing Forms432
Adding Controls to a Form435
Adding Forms to an Application439
Setting the Tab Order444
Setting Form Properties445
Using Modal and Modeless Forms446
Chapter 14Debugging C# Programs454
Debugging C# and .NET Applications Using DbgCLR.exe459
Troubleshooting .NET Applications Using Just-In-Time Debugging462
Running a Program in the Visual Studio Debugger463
Setting Breakpoints to Suspend a Program's Execution465
Setting Conditions on Methods467
Recovering the StackTrace470
Using the Debug Class472
Using Trace Listeners477
Writing Messages to Event Logs482
Chapter 15Building the User Interface488
Adding a Menu to a Form490
Using the Menu Designer494
Adding Menu Adornments501
Adding Shortcut Keys (Accelerators)502
Adding Images503
Adding a Toolbar504
Adding a Context Menu506
Displaying Items in a TreeView Control507
Displaying Items in a ListView Control513
An Explorer-Style Application520
Chapter 16Using Windows Controls524
Setting Properties for Controls529
Using Invisible Controls533
Responding to Control Messages534
Using One Event for Multiple Controls536
Enabling and Disabling Controls Using Idle Processing538
Using the GroupBox Control540
Grouping Radio Button Controls542
Anchoring Controls on Forms544
Docking Controls on Forms545
Chapter 17Using the Common Dialogs548
Choosing a Color551
Selecting a Text Style with FontDialog555
Opening and Saving Files557
A Word About Printing560
Selecting a Printer566
Setting Page Options568
Previewing the Print Output570
Chapter 18Using Events and Delegates572
Using Events Within C# Programs577
Writing an Event Handler579
Sorting Objects Using a Delegate581
Using a static Delegate587
Viewing a Delegate's Invocation List589
Combining and Removing Delegate Methods591
Responding to Timer Events593
Responding to System.Threading.Timer Events595

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews