Programming C# 3.0: Best-Selling Guide to Building Windows and Web Applications with C# 3.0
Book information
Description
Written by popular author and .NET expert Jesse Liberty, this thoroughly updated tutorial for beginning to intermediate programmers covers the latest release of Microsoft's popular C# language (C# 3.0) and the newest .NET platform for developing Windows and web applications. Our bestselling Programming C# 3.0, now in its fifth edition, is a world-class tutorial that goes well beyond the documentation otherwise available. Liberty doesn't just teach C#; he tells the complete story of the C# language and how it integrates with all of .NET programming, so that you can get started creating professional quality web and Windows applications. This book: Provides a comprehensive tutorial in C# and .NET programming that also serves as a useful reference you'll want by your side while you're working Covers all of the new features of the language, thoroughly integrated into every chapter, rather than tacked on at the end Provides insight into best practices and insight into real world programming by a professional programmer who worked with C# as an independent contractor for nearly a decade before joining Microsoft as a Senior Program Manager Every chapter in this book has been totally revised, and the entire book has been reorganized to respond to the significant changes in the language Full coverage, from the ground up of LINQ (Language Integrated Query) and other C# 3.0 language innovations to speed up development tasks Explains how to use C# in creating Web Applications as well as Windows Applications, using both the new Windows Presentation Foundation (WPF) and the older WinForms technology This new edition of Programming C# 3.0 is for working programmers who want to develop proficiency in Microsoft's most important language. No prior .NET experience is required for you to get started. There's no time like the present to work with C# -- and no book like this one to teach you everything you need to know. Special note to VB6 and Java programmers: if you've decided to transition to .NET, this book will take you there. Programming C# 3.0, Fifth Edition Table of Contents Preface C# and .NET About This Book What You Need to Use This Book How This Book Is Organized Part I: The C# Language Part II: C# and Data Part III: Programming with C# Part IV: The CLR and the .NET Framework Who This Book Is For Conventions Used in This Book Support We’d Like to Hear from You Using Code Examples Safari® Books Online Acknowledgments From Jesse Liberty From Donald Xie Dedications From Jesse Liberty From Donald Xie Part I The C# Language C# 3.0 and .NET 3.5 The Evolution of C# The C# Language A Tiny Bit of History C# Features The .NET Platform Getting Started: “Hello World” Classes, Objects, and Types Methods Comments Console Applications Namespaces The Dot Operator (.) The using Directive Case Sensitivity The static Keyword Developing “Hello World” Editing “Hello World” Compiling and Running “Hello World” Using the Visual Studio 2008 Debugger C# Language Fundamentals Types The Built-In Types Choosing a built-in type Converting built-in types Variables and Constants Definite Assignment Constants Enumerations Strings Identifiers Whitespace Statements Unconditional Branching Statements Conditional Branching Statements if...else statements Nested if statements switch statements: an alternative to nested ifs Switch on string statements Iteration Statements The goto statement The while loop The do...while loop The for loop The foreach statement The continue and break statements Operators The Assignment Operator (=) Mathematical Operators Simple arithmetical operators (+, -, *, /) The modulus operator (%) to return remainders Increment and Decrement Operators Calculate and reassign operators The prefix and postfix operators Relational Operators Use of Logical Operators with Conditionals Operator Precedence The Ternary Operator Preprocessor Directives Defining Identifiers Undefining Identifiers #if, #elif, #else, and #endif Classes and Objects Defining Classes Access Modifiers Method Arguments Creating Objects Constructors Initializers The ICloneable Interface The this Keyword Using Static Members Invoking Static Methods Using Static Constructors Static Classes Using Static Fields Destroying Objects The C# Destructor Destructors Versus Dispose Implementing the Close() Method The using Statement Passing Parameters Passing by Reference Overcoming Definite Assignment with out Parameters Overloading Methods and Constructors Encapsulating Data with Properties The get Accessor The set Accessor Property Access Modifiers readonly Fields Inheritance and Polymorphism Specialization and Generalization Inheritance Implementing Inheritance Polymorphism Creating Polymorphic Types Creating Polymorphic Methods Calling Base Class Constructors Controlling Access Versioning with the new and override Keywords Abstract Classes Limitations of Abstract Sealed Class The Root of All Types: Object Nesting Classes Operator Overloading Using the operator Keyword Supporting Other .NET Languages Creating Useful Operators Logical Pairs The Equality Operator Conversion Operators Putting Operators to Work Structs Defining Structs Creating Structs Structs As Value Types Interfaces Defining and Implementing an Interface Implementing More Than One Interface Extending Interfaces Combining Interfaces Polymorphism with Interfaces Interface Versus Abstract Class Overriding Interface Implementations Explicit Interface Implementation Selectively Exposing Interface Methods Member Hiding Arrays, Indexers, and Collections Arrays Declaring Arrays Understanding Default Values Accessing Array Elements The foreach Statement Initializing Array Elements The params Keyword Multidimensional Arrays Rectangular arrays Jagged arrays Array Bounds Array Conversions Sorting Arrays Indexers Indexers and Assignment Indexing on Other Values Collection Interfaces The IEnumerable Interface Constraints List Implementing IComparable Implementing IComparer Queues Stacks Dictionaries IDictionary Strings and Regular Expressions Strings Creating Strings The ToString() Method Manipulating Strings Finding Substrings Splitting Strings Manipulating Dynamic Strings Regular Expressions Using Regular Expressions: Regex Using Regex Match Collections Using Regex Groups Using CaptureCollection Exceptions Throwing and Catching Exceptions The throw Statement The catch Statement Taking corrective action Unwinding the call stack Try/Catch Best Practices The finally Statement Exception Objects Delegates and Events Events Events and Delegates Indirect Invocation Publish and Subscribe/Observer The Publishing Class: Clock Registering to Be Notified Sequence of Events The Danger with Delegates The event Keyword Anonymous Methods Lambda Expressions Callback Methods Part II C# and Data Introducing LINQ Defining and Executing a Query Creating the Query The from clause Filtering Projection (or select) Deferred Query Evaluation LINQ and C# Joining Ordering and the var Keyword Grouping and the group Keyword Anonymous Types Implicitly Typed Local Variables Extension Methods Defining and Using Extension Methods Extension Method Restrictions Lambda Expressions in LINQ Working with XML XML Basics (A Quick Review) Elements XHTML X Stands for eXtensible Creating XML Documents XML Elements XML Attributes Searching in XML with XPath Searching for a Single Node Searching Using Axes Predicates XPath Functions Searching Using XPathNavigator Using XPathNodeIterator Using XPathExpression XML Serialization Customizing XML Serialization Using Attributes Runtime XML Serialization Customization Putting LINQ to Work Getting Set Up LINQ to SQL Fundamentals Using Visual Studio LINQ to SQL Designer Retrieving Data Creating Properties for Each Table A LINQ Query Updating Data Using LINQ to SQL Adding a Customer Record Modifying a Customer Record Deleting Relational Data LINQ to XML ADO.NET and Relational Databases Relational Databases and SQL Tables, Records, and Columns Normalization Declarative Referential Integrity SQL The ADO.NET Object Model DataTables and DataColumns DataRelations Rows Data Adapter DBCommand and DBConnection DataReader Getting Started with ADO.NET Part III Programming with C# Programming ASP.NET Applications Web Forms Fundamentals Web Forms Events Postback versus nonpostback events State Web Forms Life Cycle Creating a Web Form Code-Behind Files Adding Controls Server Controls Data Binding Examining the Code Adding Controls and Events Programming WPF Applications WPF in a Very Small Nutshell Creating a WPF Example The Example Program Building the Application Grids and Stack Panels Sucking on a Fire Hose Our goals Adding Data Instantiating objects declaratively Using the Data in the XAML Defining the Listbox The Complete XAML File Event Handling (Finally!) What Have You Learned, Dorothy? Programming Windows Forms Applications Creating the Application Creating Event Handlers Populating the TreeView Controls TreeNode objects Recursing through the subdirectories Getting the files in the directory Handling TreeView Events Clicking the source TreeView Expanding a directory Clicking the target TreeView Handling the Clear button event Implementing the Copy Button Event Getting the selected files Sorting the list of selected files Handling the Delete Button Event Part IV The CLR and the .NET Framework Attributes and Reflection Attributes Types of Attributes Attribute targets Applying attributes Custom Attributes Declaring an attribute Naming an attribute Constructing an attribute Using an attribute Reflection Viewing Metadata Type Discovery Reflecting on a Type Finding all type members Finding type methods Finding particular type members Late Binding Threads and Synchronization Threads Starting Threads Joining Threads Blocking Threads with Sleep Killing Threads Synchronization Using Interlocked Using Locks Using Monitors Race Conditions and Deadlocks Race Conditions Deadlocks Streams Files and Directories Working with Directories Creating a DirectoryInfo Object Working with Files Modifying Files Reading and Writing Data Binary Files Buffered Streams Working with Text Files Asynchronous I/O Network I/O Creating a Network Streaming Server Creating a Streaming Network Client Handling Multiple Connections Asynchronous Network File Streaming Web Streams Serialization Using a Formatter Working with Serialization Serializing the object Deserializing the object Handling Transient Data Isolated Storage Programming .NET and COM Importing ActiveX Controls Creating an ActiveX Control Importing a Control in .NET Importing a control Manually importing the control Adding the control to the form P/Invoke Pointers C# Keywords Index
Similar books
Programming C#
2008 · PDF
MySQL® Notes for Professionals book
2018 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF
Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36
2010 · PDF
THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.
1858 · PDF
Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.
2022 · PDF
The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians
1809 · PDF