Abolrous Wordware Publishing, Inc... All Rights Reserved 1100 Summit Avenue, Suite 102 Plano, Texas 75074 No part of this book may be reproduced in any form or by any means without permi
Trang 2Learn C#
Includes the C# 3.0 Features
Sam A Abolrous
Wordware Publishing, Inc.
Trang 3Library of Congress Cataloging-in-Publication Data
Abolrous, Sam A
Learn C# / by Sam A Abolrous
p cm
Includes index
ISBN-13: 978-1-59822-035-3 (pbk.)
ISBN-10: 1-59822-035-7
1 C# (Computer program language) I Title
QA76.73.C154A416 2007
005.13'3 dc22 2007024261
© 2008, Wordware Publishing, Inc.
All Rights Reserved
1100 Summit Avenue, Suite 102 Plano, Texas 75074
No part of this book may be reproduced in any form or by any means
without permission in writing from Wordware Publishing, Inc.
Printed in the United States of America
ISBN-13: 978-1-59822-035-3
ISBN-10: 1-59822-035-7
10 9 8 7 6 5 4 3 2 1
0708
All brand names and product names mentioned in this book are trademarks or service marks of their respective companies Any omission or misuse (of any kind) of service marks or trademarks should not be regarded as intent to infringe on the property of others The publisher recognizes and respects all marks used by companies, manufacturers, and developers as a means to distinguish their products
This book is sold as is, without warranty of any kind, either express or implied, respecting the contents of this book and any disks or programs that may accompany it, including but not limited to implied warranties for the book’s quality, performance, merchantability, or fitness for any particular purpose Neither
Wordware Publishing, Inc nor its dealers or distributors shall be liable to the purchaser or any other person
or entity with respect to any liability, loss, or damage caused or alleged to have been caused directly or indirectly by this book
All inquiries for volume purchases of this book should be addressed to Wordware Publishing, Inc.,
at the above address Telephone inquiries may be made by calling:
(972) 423-0090
Trang 4To Camelia, my love and my wife.
Trang 5This page intentionally left blank.
Trang 6Swap method, 141-142
using, 295-296
switch construct, 71-74
System.Array class, 85
System.Attribute class, 167
System.Collections.Generic namespace, 276
System.Exception class, 193
System.GC.Collect method, 5
System.Nullable structure, 54
T
target elements, 167
text files,
appending, 206
reading, 205
writing, 206
this keyword, 115, 148, 339
throw keyword, 84, 193-194, 214
ToString method, 23
overriding, 152-153
try-catch statement, 193
using, 197-199
try-catch-finally statement, 194
using, 210-211
try-finally statement, 194
using, 208-209
two-dimensional arrays, 84, 86
type argument, 276, 292
type conversion, 46-47
explicit, 47
implicit, 46
type parameter, 276, 292
types, 3
anonymous, 340-344
concrete, 276
converting, 46-47
generic, 276
initializing, 334-336
nullable, 53
retrieving, 43
testing, 182-185
using default, 297
U
unary operators, 40
unboxing, 35-37
unions, emulating, 172-173
unsafe code, 31
user-defined exceptions, 212-213
using directive, 21
V
value keyword, 106 Value property, 54 value types, 31, 33 converting to reference types, 35-37 default values of, 34
var keyword, 331 variables, captured, 229 initializing, 23, 33-34 local, 22-23
numeric, 23 outer, 229-230 range, 351 versioning, 186-189 virtual keyword, 130-131 virtual methods, overriding, 132-136 Visual Studio,
Code Editor, 323-328 compiling applications in, 312 Error List window, 311 installing, 331 opening existing application in, 313 Properties window, 311
Solution Explorer, 309-310 Start Page, 305-306 starting application in, 306-307 using, 12
void type, 19
W
web site applications, 320-321 creating, 321-322
executing, 322 where keyword, 297-298 while loop, 80-81 do-while loop, 83 Windows applications, creating, 316-318 running, 318-319 using multiple forms in, 319 Write method, 20
WriteLine method, 20, 23-24 using, 49-52
X
XML tags, adding to code, 28-29
Y
yield return statement, 269-270, 272 yield statement, 271
Index | 405
Trang 7Visit us online at www.wordware.com for more information Use the following coupon code for online specials: csharp0357
Looking for more?
Check out Wordware’s market-leading Applications Library featuring the following titles.
SQL for Microsoft Access 1-55622-092-8 • $39.95
6 x 9 • 360 pp
Camtasia Studio 4: The
Definitive Guide
1-59822-037-3 • $39.95
6 x 9 • 600 pp
Learn FileMaker Pro 9 1-59822-046-2 • $39.95
6 x 9 • 550 pp
Advanced SQL Functions in
Oracle 10g
1-59822-021-7 • $36.95
6 x 9 • 416 pp
FileMaker Web Publishing:
A Complete Guide to Using the API for PHP
1-59822-041-1 • $49.95
6 x 9 • 472 pp
Introduction to Game Pro-gramming with C++
1-59822-032-2 • $44.95
6 x 9 • 392 pp
Access 2003 Programming
by Example with VBA, XML, and ASP 1-55622-223-8 • $39.95
6 x 9 • 704 pp
Word 2003 Document Auto-mation with VBA, XML, XSLT and Smart Documents 1-55622-086-3 • $36.95
6 x 9 • 464 pp
Excel 2003 VBA Programming with XML and ASP 1-55622-225-4 • $36.95
6 x 9 • 968 pp
Microsoft Excel Functions
& Formulas 1-59822-011-X • $29.95
6 x 9 • 416 pp
FileMaker Pro Business Applications 1-59822-014-4 • $49.95
6 x 9 • 648 pp
Managing Virtual Teams:
Getting the Most From Wikis, Blogs, and Other Collaborative Tools
1-59822-028-4 • $29.95
6 x 9 • 400 pp
Essential LightWave v9
1-59822-024-1 • $49.95
6 x 9 • 992 pp
LightWave v9 Texturing 1-59822-029-2 • $44.95
6 x 9 • 648 pp
LightWave v9 Lighting 1-59822-039-X • $44.95
6 x 9 • 616 pp