ENGLISH

Microsoft Visual C# Step by Step

Book information

Language
english
Format
PDF
Filesize
38 MB (40041262 bytes)
Edition
9
Pages
1104\1104
Time added
2018-10-24 16:56:45

Description

Title Page......Page 2 Copyright Page......Page 4 Contents at a Glance......Page 6 Contents......Page 8 Acknowledgments......Page 20 About the Author......Page 21 Introduction......Page 22 PART I INTRODUCING MICROSOFT VISUAL C# AND MICROSOFT VISUAL STUDIO 2017......Page 32 Beginning programming with the Visual Studio 2017 environment......Page 33 Writing your first program......Page 38 Using namespaces......Page 45 Creating a graphical application......Page 49 Examining the Universal Windows Platform app......Page 58 Adding code to the graphical application......Page 61 Summary......Page 65 Quick reference......Page 66 Understanding statements......Page 67 Identifying keywords......Page 68 Using variables......Page 69 Declaring variables......Page 70 Specifying numeric values......Page 71 Working with primitive data types......Page 72 Displaying primitive data type values......Page 73 Operators and types......Page 80 Examining arithmetic operators......Page 82 Controlling precedence......Page 87 Associativity and the assignment operator......Page 88 Prefix and postfix......Page 89 Declaring implicitly typed local variables......Page 90 Summary......Page 91 Quick reference......Page 92 Declaring a method......Page 93 Returning data from a method......Page 95 Using expression-bodied methods......Page 96 Calling methods......Page 97 Specifying the method call syntax......Page 98 Returning multiple values from a method......Page 100 Applying scope......Page 103 Defining class scope......Page 104 Overloading methods......Page 105 Writing methods......Page 106 Refactoring code......Page 111 Nesting methods......Page 115 Using optional parameters and named arguments......Page 118 Defining optional parameters......Page 119 Resolving ambiguities with optional parameters and named arguments......Page 120 Quick reference......Page 126 Declaring Boolean variables......Page 129 Understanding equality and relational operators......Page 130 Understanding conditional logical operators......Page 131 Summarizing operator precedence and associativity......Page 132 Understanding if statement syntax......Page 133 Using blocks to group statements......Page 135 Cascading if statements......Page 136 Using switch statements......Page 141 Understanding switch statement syntax......Page 142 Following the switch statement rules......Page 143 Quick reference......Page 147 Using compound assignment operators......Page 149 Writing while statements......Page 151 Writing for statements......Page 156 Understanding for statement scope......Page 157 Writing do statements......Page 158 Summary......Page 166 Quick reference......Page 167 Coping with errors......Page 168 Trying code and catching exceptions......Page 169 Unhandled exceptions......Page 170 Using multiple catch handlers......Page 171 Catching multiple exceptions......Page 172 Filtering exceptions......Page 173 Propagating exceptions......Page 178 Using checked and unchecked integer arithmetic......Page 179 Writing checked statements......Page 180 Writing checked expressions......Page 181 Throwing exceptions......Page 185 Using a finally block......Page 190 Summary......Page 191 Quick reference......Page 192 PART II UNDERSTANDING THE C# OBJECT MODEL......Page 193 Understanding classification......Page 194 Defining and using a class......Page 195 Controlling accessibility......Page 196 Working with constructors......Page 198 Overloading constructors......Page 200 Deconstructing an object......Page 208 Understanding static methods and data......Page 209 Creating a shared field......Page 210 Creating a static field by using the const keyword......Page 211 Static using statements......Page 212 Anonymous classes......Page 215 Quick reference......Page 216 Copying value type variables and classes......Page 218 Understanding null values and nullable types......Page 224 The null-conditional operator......Page 225 Using nullable types......Page 226 Understanding the properties of nullable types......Page 227 Creating ref parameters......Page 228 Creating out parameters......Page 229 How computer memory is organized......Page 232 Using the stack and the heap......Page 233 The System.Object class......Page 234 Boxing......Page 235 Unboxing......Page 236 The is operator......Page 237 The switch statement revisited......Page 238 Quick reference......Page 242 Declaring an enumeration......Page 244 Using an enumeration......Page 245 Choosing an enumeration’s underlying type......Page 246 Working with structures......Page 249 Declaring a structure......Page 250 Understanding differences between structures and classes......Page 251 Understanding structure initialization......Page 253 Copying structure variables......Page 258 Summary......Page 261 Quick reference......Page 262 Declaring array variables......Page 263 Creating an array instance......Page 264 Populating and using an array......Page 265 Creating an implicitly typed array......Page 266 Iterating through an array......Page 267 Passing arrays as parameters and return values for a method......Page 269 Copying arrays......Page 270 Using multidimensional arrays......Page 272 Creating jagged arrays......Page 273 Accessing arrays that contain value types......Page 283 Quick reference......Page 286 Overloading—a recap......Page 288 Using array arguments......Page 289 Declaring a params array......Page 290 Using params object[ ]......Page 292 Using a params array......Page 294 Comparing parameter arrays and optional parameters......Page 297 Summary......Page 299 Quick reference......Page 300 What is inheritance?......Page 301 Using inheritance......Page 302 Calling base-class constructors......Page 304 Assigning classes......Page 305 Declaring new methods......Page 307 Declaring virtual methods......Page 308 Declaring override methods......Page 309 Understanding protected access......Page 311 Creating extension methods......Page 317 Quick reference......Page 321 Understanding interfaces......Page 323 Defining an interface......Page 324 Implementing an interface......Page 325 Referencing a class through its interface......Page 326 Explicitly implementing an interface......Page 327 Interface restrictions......Page 329 Defining and using interfaces......Page 330 Abstract classes......Page 339 Abstract methods......Page 340 Implementing and using an abstract class......Page 341 Summary......Page 347 Quick reference......Page 348 The life and times of an object......Page 349 Writing destructors......Page 350 Why use the garbage collector?......Page 352 How does the garbage collector work?......Page 354 Resource management......Page 355 Exception-safe disposal......Page 356 The using statement and the IDisposable interface......Page 357 Calling the Dispose method from a destructor......Page 359 Implementing exception-safe disposal......Page 360 Quick reference......Page 369 PART III DEFINING EXTENSIBLE TYPES WITH C#......Page 371 Implementing encapsulation by using methods......Page 372 What are properties?......Page 374 Using properties......Page 376 Read-only properties......Page 377 Property accessibility......Page 378 Understanding the property restrictions......Page 379 Declaring interface properties......Page 381 Replacing methods with properties......Page 382 Generating automatic properties......Page 386 Initializing objects by using properties......Page 388 Quick reference......Page 392 Storing binary values......Page 395 Displaying binary values......Page 396 Manipulating binary values......Page 397 Solving the same problems using indexers......Page 398 Understanding indexer accessors......Page 400 Comparing indexers and arrays......Page 401 Indexers in interfaces......Page 403 Using indexers in a Windows application......Page 404 Quick reference......Page 409 The problem: Misusing with the object type......Page 412 The generics solution......Page 415 The theory of binary trees......Page 418 Building a binary tree class by using generics......Page 422 Creating a generic method......Page 431 Defining a generic method to build a binary tree......Page 432 Variance and generic interfaces......Page 434 Covariant interfaces......Page 436 Contravariant interfaces......Page 438 Quick reference......Page 440 What are collection classes?......Page 442 The List collection class......Page 444 The LinkedList collection class......Page 446 The Queue collection class......Page 447 The Stack collection class......Page 448 The Dictionary collection class......Page 449 The SortedList collection class......Page 451 The HashSet collection class......Page 452 Using collection initializers......Page 453 The Find methods, predicates, and lambda expressions......Page 454 The forms of lambda expressions......Page 456 Comparing arrays and collections......Page 458 Using collection classes to play cards......Page 459 Quick reference......Page 463 Enumerating the elements in a collection......Page 466 Manually implementing an enumerator......Page 467 Implementing the IEnumerable interface......Page 472 Implementing an enumerator by using an iterator......Page 474 A simple iterator......Page 475 Defining an enumerator for the Tree class by using an iterator......Page 477 Summary......Page 479 Quick reference......Page 480 Chapter 20 Decoupling application logic and handling events......Page 481 Understanding delegates......Page 482 Examples of delegates in the .NET Framework class library......Page 483 Implementing the factory by using a delegate......Page 485 Declaring and using delegates......Page 488 Creating a method adapter......Page 496 Enabling notifications by using events......Page 497 Subscribing to an event......Page 498 Raising an event......Page 499 Understanding user interface events......Page 500 Using events......Page 501 Quick reference......Page 507 What is LINQ?......Page 510 Using LINQ in a C# application......Page 511 Selecting data......Page 513 Filtering data......Page 515 Ordering, grouping, and aggregating data......Page 516 Joining data......Page 518 Using query operators......Page 519 Querying data in Tree objects......Page 522 LINQ and deferred evaluation......Page 529 Quick reference......Page 532 Understanding operators......Page 535 Overloaded operators......Page 536 Creating symmetric operators......Page 537 Understanding compound assignment evaluation......Page 539 Declaring increment and decrement operators......Page 540 Comparing operators in structures and classes......Page 541 Implementing operators......Page 542 Understanding conversion operators......Page 548 Providing built-in conversions......Page 549 Implementing user-defined conversion operators......Page 550 Writing conversion operators......Page 551 Summary......Page 553 Quick reference......Page 554 PART IV BUILDING UNIVERSAL WINDOWS PLATFORM APPLICATIONS WITH C#......Page 555 Why perform multitasking by using parallel processing?......Page 556 The rise of the multicore processor......Page 557 Tasks, threads, and the ThreadPool......Page 558 Creating, running, and controlling tasks......Page 560 Using the Task class to implement parallelism......Page 562 Abstracting tasks by using the Parallel class......Page 576 When not to use the Parallel class......Page 580 The mechanics of cooperative cancellation......Page 582 Using continuations with canceled and faulted tasks......Page 594 Quick reference......Page 595 Chapter 24 Improving response time by performing asynchronous operations......Page 598 Defining asynchronous methods: The problem......Page 599 Defining asynchronous methods: The solution......Page 602 Defining asynchronous methods that return values......Page 609 Asynchronous method gotchas......Page 610 Asynchronous methods and the Windows Runtime APIs......Page 612 Tasks, memory allocation, and efficiency......Page 614 Using PLINQ to parallelize declarative data access......Page 616 Using PLINQ to improve performance while iterating through a collection......Page 617 Canceling a PLINQ query......Page 621 Synchronizing concurrent access to data......Page 622 Synchronization primitives for coordinating tasks......Page 625 Canceling synchronization......Page 627 The concurrent collection classes......Page 628 Using a concurrent collection and a lock to implement thread-safe data access......Page 629 Summary......Page 638 Quick reference......Page 639 Chapter 25 Implementing the user interface for a Universal Windows Platform app......Page 641 Features of a Universal Windows Platform app......Page 642 Using the Blank App template to build a Universal Windows Platform app......Page 645 Implementing a scalable user interface......Page 648 Applying styles to a UI......Page 678 Quick reference......Page 687 Implementing the Model–View–ViewModel pattern......Page 688 Displaying data by using data binding......Page 689 Modifying data by using data binding......Page 696 Using data binding with a ComboBox control......Page 700 Creating a ViewModel......Page 703 Adding commands to a ViewModel......Page 706 Searching for data using Cortana......Page 716 Providing a vocal response to voice commands......Page 729 Summary......Page 732 Quick reference......Page 733 Retrieving data from a database......Page 734 Creating an entity model......Page 741 Creating and using a REST web service......Page 750 Inserting, updating, and deleting data through a REST web service......Page 766 Reporting errors and updating the UI......Page 777 Summary......Page 784 Quick reference......Page 785 Index......Page 787 Code Snippets......Page 879

Similar books