Adobe® Digital Editions software.This eBook requires the free
Before downloading this DRM-encrypted PDF, be sure to:
Also available in other formats.
Register your product to gain access to bonus material or receive a coupon.
In just 21 days readers will learn how to use the key features of the C# programming language¿not only the commands, but how to create entire programs using them within a few simple chapters. This book is designed to teach C# from the ground up¿each lesson is built to supplement the chapter before to provide a fully rounded understanding of the C# language. Sams Teach Yourself the C# Language in 21 Days is the only book on the market that takes C# out of the Microsoft Visual Studio and teaches it as a platform-independent language¿letting readers program for Windows, FreeBSD, and Mac OS X. Additional coverage added from the first edition: more and better Windows Forms information, database access, XML, types, runs, appendix for Visual C++ .NET users, plus much more. This book also includes a CD-ROM full of third-party editor software and sample code, making it an easy-to-use, all-in-one package.
WEEK 1. AT A GLANCE.1. Getting Started with C#.
What Is C#? Preparing to Program. The Program-Development Cycle. Creating Your First C# Program. Types of C# Programs. Creating Your First Window Application. Why C#? A High-Level View of .NET. C# and Object-Oriented Programming (OOP). Summary. Q&A. Workshop.
TYPE & RUN 1. NUMBERING YOUR LISTINGS.
The First Type & Run.2. Understanding C# Programs.
Dissecting a C# Application. Basic Parts of a C# Application. Exploring the Structure of a C# Application. Analyzing Listing 2.1. Storing Information with Variables. Using Your Variables. Understanding Your Computer's Memory. Introducing the C# Data Types. Numeric Variable Types. Literals Versus Variables. Creating Constants. A Peek at Reference Types. Summary. Q&A. Workshop.3. Manipulating Values in Your Programs.
Displaying Basic Information. Manipulating Variable Values with Operators. Understanding Punctuators. Moving Values with the Assignment Operator. Working with Mathematical/Arithmetic Operators. Making Comparisons with Relational Operators. Understanding Logical Bitwise Operators. Understanding the Type Operators. Using the sizeof Operator. Shortcutting with the Conditional Operator. Understanding Operator Precedence.Converting Data Types. Understanding Operator Promotion. Bonus Material: For Those Brave Enough. Summary. Q&A. Workshop.4. Controlling Your Program's Flow.
Controlling Program Flow. Using Selection Statements. Using Iteration Statements. Reviewing goto. Nesting Flow. Summary. Q&A. Workshop.
TYPE & RUN 2. GUESS THE NUMBER!
The Guess Type & Run. The WinGuess Type & Run.5. The Core of C# Programming: Classes.
Digging into Object-Oriented Programming. Defining a Class. Declaring Classes. Working with Data Members, a.k.a. Fields. Using Static Variables. Inspecting the Application Class. Creating Properties. A First Look at Namespaces. Summary. Q&A. Workshop.6. Packaging Functionality: Class Methods and Member Functions.
Getting Started with Methods. Using Methods. Understanding Program Flow with Method. Exploring the Format of a Method. Passing Values to Methods. Types of Class Methods. Summary. Q&A. Workshop.7. Storing More Complex Stuff: Structures, Enumerators, and Arrays.
Working with Structures. Clarifying with Enumerators. Using Arrays to Store Data. Summary. Q&A. Workshop.
WEEK 1. WEEK IN REVIEW.
The WR01.cs Program.
WEEK 2. WEEK AT A GLANCE.8. Advanced Method Access.
Overloading Methods. Using a Variable Number of Parameters. Understanding Scope. Creating Classes with No Objects. Revisiting Namespaces. Summary. Q&A. Workshop.9. Handling Problems in Your Programs: Exceptions and Errors.
Understanding the Concept of Handling Problems. Exception Handling. Adding Finality with finally. Common Exceptions. Defining Your Own Exception Classes. Throwing Your Own Exceptions. Using checked Versus unchecked Statements. What Is Debugging? Understanding the Types of Errors. Finding Errors. Tracing Code with Code Walkthroughs. Working with Preprocessor Directives. Using Debuggers. Summary. Q&A. Workshop.
TYPE & RUN 3. LINES AND CIRCLES AND SQUARES, "OH MY!".10. Reusing Existing Code with Inheritance.
Understanding the Basics of Inheritance. Exploring Polymorphism and Inherited Classes. Working with Virtual Methods. Working with Abstract Classes. Sealing Classes. The Ultimate Base Class: Object. Using the is and as Keywords with Classes-Class Conversions. Working with Arrays of Different Object Types. Summary. Q&A. Workshop.11. Formatting Formatting and Retrieving Information.
Understanding Console Input and Output. Formatting Information. Working More Closely with Strings. Getting Information from the Console. Summary. Q&A. Workshop.12. Tapping into OOP: Interfaces.
Interfaces: A First Look. Using Interfaces. Defining Interfaces. Using Multiple Interfaces. Using Explicit Interface Members. Deriving New Interfaces from Existing Ones. Hiding Interface Members. Summary. Q&A. Workshop.13. Making Your Programs React with Delegates, Events, and Indexers.
Using an Indexer. Exploring Delegates. Working with Events. Summary. Q&A. Workshop.14. Making Operators Do Your Bidding: Overloading.
Overloading Functions Revisited. Overloading Operators. Summary. Q&A. Workshop.
WEEK 2. WEEK IN REVIEW.
WEEK 3. WEEK AT A GLANCE.
A Caution on Week 3.15. Using Existing Routines from the .NET Base Classes.
Classes in the .NET Framework. Working with a Timer. Getting Directory and System Environment Information. Working with Math Routines. Working with Files. Working with Simple Data Files. Summary. Q&A. Workshop.16. Creating Windows Forms.
Working with Windows and Forms. Creating Windows Forms. Customizing a Form. Adding Controls to a Form. Summary. Q&A. Workshop.17. Creating Windows Applications.
Working with Radio Buttons. Working with List Boxes. Adding Menus to Your Forms. Displaying Pop-Up Dialog Boxes and Forms. Summary. Q&A. Workshop.
TYPE & RUN 4. TIC TAC TOE.
The Tic Tac Toe Code.18. Working with Data and Databases.
Understanding Key Database Concepts. Introducing ADO.NET. Connecting to and Working with a Database. Adding, Updating, and Deleting Data. Other Database Concepts. Summary. Q&A. Workshop.19. Creating Remote Procedures: Web Services.
Creating Web Applications. Examining the Concept of a Component. Web Services. Summary. Q&A. Workshop.
TYPE & RUN 5. QUOTE OF THE DAY WEB SERVICE.
The Web Service File. The Proxy File. Using the Service.20. Creating Web Applications.
Creating Regular Web Applications. Summary. Q&A. Workshop.21. A Day for Reflection and Attributes.
Reflecting on Reflection. Understanding Attributes. Reflecting on the Future of C#. Summary. Congratulations! Q&A. Workshop.
WEEK 3. WEEK IN REVIEW.
Apply What You Know. Show What You Know.
APPENDICES.Appendix A. C# Keywords.
abstract. as. base. bool. break. byte. case. catch. char. checked. class. const. continue. decimal. default. delegate. do. double. else. enum. event. explicit. extern. false. finally. fixed. float. for. foreach. get. goto. if. implicit. in. int. interface. internal. is. lock. long. namespace. new. null. object. operator. out. override. params. partial. private. protected. public. readonly. ref. return. byte. sealed. set. short. sizeof. stackalloc. static. string. struct. switch. this. throw. true. try. typeof. uint. ulong. unchecked. unsafe. ushort. using. value. virtual. void. where. while. yield.Appendix B. Command-Line Compiler Flags for Microsoft Visual C# .NET.
Output. Input. Resource. Code Generation. Errors and Warnings. Programming Language. Miscellaneous. Advanced.Appendix C. Understanding Number Systems.
The Decimal Number System. The Binary System. The Hexadecimal System.Appendix D. Using SharpDevelop.
Installing SharpDevelop. Running SharpDevelop. Creating Applications from This Book.Index.