SmartSellTM - The New Way to Sell Online

Shop over a million Toys in our Huge New Range

Your hands-on guide to Microsoft Visual C# fundamentals with Visual Studio 2015 Expand your expertise--and teach yourself the fundamentals of programming with the latest version of Visual C# with Visual Studio 2015. If you are an experienced software developer, you'll get all the guidance, exercises, and code you need to start building responsive, scalable Windows 10 and Universal Windows Platform applications with Visual C#. Discover how to: * Quickly start creating Visual C# code and projects with Visual Studio 2015* Work with variables, operators, expressions, and methods* Control program flow with decision and iteration statements* Build more robust apps with error, exception, and resource management* Master the essentials of Visual C# object-oriented programming* Use enumerations, structures, generics, collections, indexers, and other advanced features* Create in-memory data queries with LINQ query expressions* Improve application throughput and response time with asynchronous methods* Decouple application logic and event handling* Streamline development with new app templates* Implement the Model-View-ViewModel (MVVM) pattern* Build Universal Windows Platform apps that smoothly adapt to PCs, tablets, and Windows phones* Integrate Microsoft Azure cloud databases and RESTful web servicesAbout You * For software developers who are new to Visual C# or who are upgrading from older versions* Readers should have experience with at least one programming language* No prior Microsoft .NET or Visual Studio development experience required
Product Details

Table of Contents

Introduction xixPART I: INTRODUCING MICROSOFT VISUAL C# AND MICROSOFT VISUAL STUDIO 2015 Chapter 1: Welcome to C# 3Beginning programming with the Visual Studio 2015 environment 3Writing your first program 8Using namespaces 14Creating a graphical application 17Examining the Universal Windows Platform app 26Adding code to the graphical application 29Summary 32Quick Reference 32Chapter 2: Working with variables, operators, and expressions 33Understanding statements 33Using identifiers 34Identifying keywords 34Using variables 36Naming variables 36Declaring variables 37Working with primitive data types 37Unassigned local variables 38Displaying primitive data type values 38Using arithmetic operators 45Operators and types 45Examining arithmetic operators 47Controlling precedence 52Using associativity to evaluate expressions 53Associativity and the assignment operator 53Incrementing and decrementing variables 54Prefix and postfix 55Declaring implicitly typed local variables 56Summary 57Quick Reference 58Chapter 3: Writing methods and applying scope 59Creating methods 59Declaring a method 60Returning data from a method 61Using expression-bodied methods 62Calling methods 63Applying scope 66Defining local scope 66Defining class scope 67Overloading methods 68Writing methods 68Using optional parameters and named arguments 77Defining optional parameters 79Passing named arguments 79Resolving ambiguities with optional parameters and named arguments 80Summary 85Quick reference 86Chapter 4: Using decision statements 87Declaring Boolean variables 87Using Boolean operators 88Understanding equality and relational operators 88Understanding conditional logical operators 89Short circuiting 90Summarizing operator precedence and associativity 90Using if statements to make decisions 91Understanding if statement syntax 91Using blocks to group statements 93Cascading if statements 94Using switch statements 99Understanding switch statement syntax 100Following the switch statement rules 101Summary 104Quick reference 105Chapter 5: Using compound assignment and iteration statements 107Using compound assignment operators 107Writing while statements 108Writing for statements 114Understanding for statement scope 115Writing do statements 116Summary 125Quick reference 125Chapter 6: Managing errors and exceptions 127Coping with errors 127Trying code and catching exceptions 128Unhandled exceptions 129Using multiple catch handlers 130Catching multiple exceptions 131Propagating exceptions 136Using checked and unchecked integer arithmetic 138Writing checked statements 139Writing checked expressions 140Throwing exceptions 143Using a finally block 148Summary 149Quick reference 150PART II: UNDERSTANDING THE C# OBJECT MODELChapter 7: Creating and managing classes and objects 153Understanding classification 153The purpose of encapsulation 154Defining and using a class 154Controlling accessibility 156Working with constructors 157Overloading constructors 158Understanding static methods and data 167Creating a shared field 168Creating a static field by using the const keyword 169Understanding static classes 169Static using statements 170Anonymous classes 172Summary 174Quick reference 174Chapter 8: Understanding values and references 177Copying value type variables and classes 177Understanding null values and nullable types 183Using nullable types 185Understanding the properties of nullable types 186Using ref and out parameters 187Creating ref parameters 188Creating out parameters 188How computer memory is organized 190Using the stack and the heap 192The System.Object class 193Boxing 194Unboxing 194Casting data safely 196The is operator 196The as operator 197Summary 199Quick reference 199Chapter 9: Creating value types with enumerationsand structures 201Working with enumerations 201Declaring an enumeration 202Using an enumeration 202Choosing enumeration literal values 203Choosing an enumeration's underlying type 204Working with structures 206Declaring a structure 208Understanding differences between structures and classes 209Declaring structure variables 210Understanding structure initialization 211Copying structure variables 215Summary 219Quick reference 219Chapter 10: Using arrays 221Declaring and creating an array 221Declaring array variables 221Creating an array instance 222Populating and using an array 223Creating an implicitly typed array 224Accessing an individual array element 225Iterating through an array 225Passing arrays as parameters and return values for a method 227 Copying arrays 228Using multidimensional arrays 230Creating jagged arrays 231Summary 241Quick reference 242Chapter 11: Understanding parameter arrays 243Overloading-a recap 243Using array arguments 244Declaring a params array 245Using params object[ ] 247Using a params array 249Comparing parameter arrays and optional parameters 252Summary 254Quick reference 254Chapter 12: Working with inheritance 255What is inheritance? 255Using inheritance 256The System.Object class revisited 258Calling base-class constructors 258Assigning classes 259Declaring new methods 261Declaring virtual methods 262Declaring override methods 263Understanding protected access 265Understanding extension methods 271Summary 275Quick reference 276Chapter 13: Creating interfaces and defining abstract classes 277Understanding interfaces 277Defining an interface 278Implementing an interface 279Referencing a class through its interface 280Working with multiple interfaces 281Explicitly implementing an interface 282Interface restrictions 283Defining and using interfaces 284Abstract classes 293Abstract methods 295Sealed classes 295Sealed methods 295Implementing and using an abstract class 296Summary 302Quick reference 303Chapter 14: Using garbage collection and resource management 305The life and times of an object 305Writing destructors 306Why use the garbage collector? 308How does the garbage collector work? 310Recommendations 310Resource management 311Disposal methods 311Exception-safe disposal 312The using statement and the IDisposable interface 312Calling the Dispose method from a destructor 314Implementing exception-safe disposal 316Summary 325Quick reference 325PART III: DEFINING EXTENSIBLE TYPES WITH C#Chapter 15: Implementing properties to access fields 329Implementing encapsulation by using methods 329What are properties? 331Using properties 333Read-only properties 334Write-only properties 334Property accessibility 335Understanding the property restrictions 336Declaring interface properties 337Replacing methods with properties 339Generating automatic properties 343Initializing objects by using properties 345Summary 349Quick reference 350Chapter 16: Using indexers 353What is an indexer? 353An example that doesn't use indexers 353The same example using indexers 355Understanding indexer accessors 357Comparing indexers and arrays 358Indexers in interfaces 360Using indexers in a Windows application 361Summary 367Quick reference 368Chapter 17: Introducing generics 369The problem with the object type 369The generics solution 373Generics vs. generalized classes 375Generics and constraints 375Creating a generic class 376The theory of binary trees 376Building a binary tree class by using generics 379Creating a generic method 389Defining a generic method to build a binary tree 389Variance and generic interfaces 391Covariant interfaces 393Contravariant interfaces 395Summary 397Quick reference 397Chapter 18: Using collections 399What are collection classes? 399The List collection class 401The LinkedList collection class 403The Queue collection class 404The Stack collection class 405The Dictionary collection class 407The SortedList collection class 408The HashSet collection class 409Using collection initializers 411The Find methods, predicates, and lambda expressions 411The forms of lambda expressions 413Comparing arrays and collections 415Using collection classes to play cards 416Summary 420Quick reference 420Chapter 19: Enumerating collections 423Enumerating the elements in a collection 423Manually implementing an enumerator 425Implementing the IEnumerable interface 429Implementing an enumerator by using an iterator 431A simple iterator 432Defining an enumerator for the Tree class by using an iterator 434Summary 436Quick reference 437Chapter 20: Decoupling application logic and handling events 439Understanding delegates 440Examples of delegates in the .NET Framework class library 441The automated factory scenario 443Implementing the factory control system without using delegates 443Implementing the factory by using a delegate 444Declaring and using delegates 447Lambda expressions and delegates 455Creating a method adapter 455Enabling notifications by using events 456Declaring an event 456Subscribing to an event 457Unsubscribing from an event 457Raising an event 458Understanding user interface events 458Using events 460Summary 466Quick reference 466Chapter 21: Querying in-memory data by using query expressions 469What is LINQ? 469Using LINQ in a C# application 470Selecting data 472Filtering data 474Ordering, grouping, and aggregating data 475Joining data 477Using query operators 479Querying data in Tree objects 481LINQ and deferred evaluation 487Summary 491Quick reference 491Chapter 22: Operator overloading 493Understanding operators 493Operator constraints 494Overloaded operators 494Creating symmetric operators 496Understanding compound assignment evaluation 498Declaring increment and decrement operators 499Comparing operators in structures and classes 500Defining operator pairs 500Implementing operators 501Understanding conversion operators 508Providing built-in conversions 508Implementing user-defined conversion operators 509Creating symmetric operators, revisited 510Writing conversion operators 511Summary 513Quick reference 514PART IV: BUILDING UNIVERSAL WINDOWS PLATFORM APPLICATIONS WITH C# Chapter 23: Improving throughput by using tasks 517Why perform multitasking by using parallel processing? 517The rise of the multicore processor 518Implementing multitasking by using the Microsoft .NET Framework 519 Tasks, threads, and the ThreadPool 520Creating, running, and controlling tasks 521Using the Task class to implement parallelism 524Abstracting tasks by using the Parallel class 536When not to use the Parallel class 541Canceling tasks and handling exceptions 543The mechanics of cooperative cancellation 543Using continuations with canceled and faulted tasks 556Summary 557Quick reference 557Chapter 24: Improving response time by performingasynchronous operations 559Implementing asynchronous methods 560Defining asynchronous methods: The problem 560Defining asynchronous methods: The solution 564Defining asynchronous methods that return values 569Asynchronous method gotchas 570Asynchronous methods and the Windows Runtime APIs 572Using PLINQ to parallelize declarative data access 575Using PLINQ to improve performance while iterating through a collection 576Canceling a PLINQ query 580Synchronizing concurrent access to data 581Locking data 584Synchronization primitives for coordinating tasks 584Canceling synchronization 587The concurrent collection classes 587Using a concurrent collection and a lock to implement thread-safe data access 588Summary 598Quick reference 599Chapter 25: Implementing the user interface for a Universal Windows Platform app 601Features of a Universal Windows Platform app 602Using the Blank App template to build a Universal Windows Platform app 605Implementing a scalable user interface 607Applying styles to a UI 638Summary 649Quick reference 649Chapter 26: Displaying and searching for data in a Universal Windows Platform app 651Implementing the Model-View-ViewModel pattern 651Displaying data by using data binding 652Modifying data by using data binding 659Using data binding with a ComboBox control 663Creating a ViewModel 665Adding commands to a ViewModel 669Searching for data using Cortana 680Providing a vocal response to voice commands 692Summary 695Quick reference 696Chapter 27: Accessing a remote database from a Universal Windows Platform app 697Retrieving data from a database 698Creating an entity model 703Creating and using a REST web service 712Inserting, updating, and deleting data through a REST web service 728Reporting errors and updating the UI 738Summary 746Quick reference 747Index 749

About the Author

John Sharp is a principal technologist at Content Master, part of CM Group Ltd., a technical authoring and consulting company based in Gloucester, in the UK. An expert on developing Microsoft .NET applications, he has created many tutorials, white papers, and presentations on distributed systems, web services, cloud applications, and the C# language. He is the author of Windows Communication Foundation Step by Step and helped develop Microsoft Certification Course 70-480: Programming in HTML5 with JavaScript and CSS3.

Look for similar items by category
Home » Books » Computers » Programming » C#
People also searched for
How Fishpond Works
Fishpond works with suppliers all over the world to bring you a huge selection of products, really great prices, and delivery included on over 25 million products that we sell. We do our best every day to make Fishpond an awesome place for customers to shop and get what they want — all at the best prices online.
Webmasters, Bloggers & Website Owners
You can earn a 5% commission by selling Microsoft Visual C# Step by Step on your website. It's easy to get started - we will give you example code. After you're set-up, your website can earn you money while you work, play or even sleep! You should start right now!
Authors / Publishers
Are you the Author or Publisher of a book? Or the manufacturer of one of the millions of products that we sell. You can improve sales and grow your revenue by submitting additional information on this title. The better the information we have about a product, the more we will sell!
Item ships from and is sold by Fishpond World Ltd.
Back to top