Hilfe Warenkorb Konto Anmelden
 
 
   Schnellsuche   
     zur Expertensuche                      
Beginning C# 7 Programming with Visual Studio 2017
  Großes Bild
 
Beginning C# 7 Programming with Visual Studio 2017
von: Benjamin Perkins, Jacob Vibe Hammer, Jon D. Reid
Wrox, 2018
ISBN: 9781119458722
915 Seiten, Download: 22799 KB
 
Format:  PDF
geeignet für: Apple iPad, Android Tablet PC's Online-Lesen PC, MAC, Laptop

Typ: A (einfacher Zugriff)

 

 
eBook anfordern
Inhaltsverzeichnis

  Cover 1  
  Title Page 3  
  Copyright 4  
  About the Authors 5  
  About the Technical Editor 5  
  Credits 6  
  Acknowledgments 7  
  Contents 9  
  Introduction 23  
     Who This Book is for 24  
     What This Book Covers 24  
     How This Book is Structured 25  
        The C# Language (Chapters 1–13) 25  
        Windows Programming (Chapters 14–15) 26  
        Cloud and Cross-Platform Programming (Chapters 16–19) 26  
        Data Access (Chapters 20–23) 27  
        Additional Techniques (Chapters 24–25) 27  
     What you Need to use This Book 28  
     Conventions 28  
     Source Code 29  
     Errata 29  
  Part I: The C# Language 31  
     Chapter 1: Introducing C# 33  
        What is the .NET Framework? 34  
           What’s in the .NET Framework? 34  
           .NET Standard and .NET Core 35  
           Writing Applications Using the .NET Framework and .NET Core 35  
              CIL and JIT 36  
              Assemblies 37  
              Managed Code 37  
              Garbage Collection 37  
              Fitting it Together 38  
              Linking 39  
        What Is C#? 39  
           Applications You Can Write with C# 40  
           C# in this Book 41  
        Visual Studio 2017 41  
           Visual Studio 2017 Products 41  
           Solutions 42  
     Chapter 2: Writing a C# Program 45  
        The Visual Studio 2017 Development Environment 46  
        Console Applications 51  
           The Solution Explorer 54  
           The Properties Window 55  
           The Error List Window 55  
        Desktop Applications 56  
     Chapter 3: Variables and Expressions 63  
        Basic C# Syntax 64  
        Basic C# Console Application Structure 66  
        Variables 68  
           Simple Types 68  
           Variable Naming 73  
           Literal Values 73  
              Binary Literals and Digit Separators 74  
              String Literals 75  
        Expressions 76  
           Mathematical Operators 77  
           Assignment Operators 82  
           Operator Precedence 83  
           Namespaces 84  
     Chapter 4: Flow Control 89  
        Boolean Logic 90  
           Boolean Bitwise and Assignment Operators 92  
           Operator Precedence Updated 94  
        Branching 95  
           The Ternary Operator 95  
           The if Statement 95  
              Checking More Conditions Using if Statements 98  
           The switch Statement 99  
        Looping 102  
           do Loops 103  
           while Loops 105  
           for Loops 107  
           Interrupting Loops 108  
           Infinite Loops 109  
     Chapter 5: More about Variables 113  
        Type Conversion 114  
           Implicit Conversions 114  
           Explicit Conversions 116  
           Explicit Conversions Using the Convert Commands 118  
        Complex Variable Types 121  
           Enumerations 121  
              Defining Enumerations 122  
           Structs 126  
              Defining Structs 126  
           Arrays 129  
              Declaring Arrays 129  
              foreach Loops 132  
              Pattern Matching with switch case expression 132  
              Multidimensional Arrays 136  
              Arrays of Arrays 138  
        String Manipulation 139  
     Chapter 6: Functions 147  
        Defining and Using Functions 148  
           Return Values 150  
           Parameters 152  
              Parameter Matching 154  
              Parameter Arrays 154  
              Reference and Value Parameters 156  
              Out Parameters 159  
              Tuples 160  
        Variable Scope 161  
           Variable Scope in Other Structures 164  
           Parameters and Return Values versus Global Data 166  
           Local Functions 167  
        The Main() Function 168  
        Struct Functions 171  
        Overloading Functions 172  
        Using Delegates 174  
     Chapter 7: Debugging and Error Handling 179  
        Debugging in Visual Studio 180  
           Debugging in Nonbreak (Normal) Mode 180  
              Outputting Debugging Information 181  
              Tracepoints 186  
              Diagnostics Output Versus Tracepoints 188  
           Debugging in Break Mode 188  
              Entering Break Mode 188  
              Monitoring Variable Content 192  
              Stepping through Code 194  
              Immediate and Command Windows 196  
              The Call Stack Window 197  
        Error Handling 197  
           try…catch…finally 198  
           Throw Expressions 205  
           Listing and Configuring Exceptions 206  
     Chapter 8: Introduction to Object-Oriented Programming 209  
        What Is Object-Oriented Programming? 210  
           What Is an Object? 211  
              Properties and Fields 212  
              Methods 213  
           Everything’s an Object 214  
           The Life Cycle of an Object 214  
              Constructors 214  
              Destructors 215  
           Static and Instance Class Members 215  
              Static Constructors 215  
              Static Classes 216  
        OOP Techniques 216  
           Interfaces 217  
              Disposable Objects 218  
           Inheritance 218  
           Polymorphism 221  
              Interface Polymorphism 222  
           Relationships between Objects 223  
              Containment 223  
              Collections 224  
           Operator Overloading 224  
           Events 225  
           Reference Types versus Value Types 225  
        OOP in Desktop Applications 226  
     Chapter 9: Defining Classes 233  
        Class Definitions in C# 234  
           Interface Definitions 236  
        System.Object 239  
        Constructors and Destructors 241  
           Constructor Execution Sequence 242  
        OOP Tools in Visual Studio 246  
           The Class View Window 246  
           The Object Browser 248  
           Adding Classes 249  
           Class Diagrams 250  
        Class Library Projects 252  
        Interfaces Versus Abstract Classes 256  
        Struct Types 258  
        Shallow Copying Versus Deep Copying 260  
     Chapter 10: Defining Class Members 263  
        Member Definitions 264  
           Defining Fields 264  
           Defining Methods 265  
           Defining Properties 266  
           Tuple Deconstruction 271  
           Refactoring Members 272  
           Automatic Properties 273  
        Additional Class Member Topics 274  
           Hiding Base Class Methods 274  
           Calling Overridden or Hidden Base Class Methods 276  
              The this Keyword 276  
           Using Nested Type Definitions 277  
        Interface Implementation 279  
           Implementing Interfaces in Classes 280  
              Explicit Interface Member Implementation 281  
              Additional Property Accessors 282  
        Partial Class Definitions 282  
        Partial Method Definitions 283  
        Example Application 285  
           Planning the Application 285  
              The Card Class 285  
              The Deck Class 285  
           Writing the Class Library 286  
              Adding the Suit and Rank Enumerations 287  
              Adding the Card Class 289  
              Adding the Deck Class 290  
           A Client Application for the Class Library 293  
        The Call Hierarchy Window 295  
     Chapter 11: Collections, Comparisons, and Conversions 299  
        Collections 300  
           Using Collections 301  
           Defining Collections 306  
           Indexers 307  
           Adding a Cards Collection to CardLib 309  
           Keyed Collections and IDictionary 312  
           Iterators 313  
           Iterators and Collections 318  
           Deep Copying 319  
           Adding Deep Copying to CardLib 320  
        Comparisons 322  
           Type Comparisons 322  
              Boxing and Unboxing 322  
              The is Operator 324  
           Pattern Matching with the is Operator Pattern Expression 327  
           Value Comparisons 328  
              Operator Overloading 328  
              Adding Operator Overloads to CardLib 332  
              The IComparable and IComparer Interfaces 338  
              Sorting Collections 339  
        Conversions 343  
           Overloading Conversion Operators 343  
           The as Operator 345  
     Chapter 12: Generics 349  
        What Are Generics? 350  
        Using Generics 351  
           Nullable Types 351  
              Operators and Nullable Types 352  
              The ?? Operator 353  
              The ?. Operator 354  
              Working with Nullable Types 355  
           The System.Collections.Generic Namespace 359  
              List 360  
              Sorting and Searching Generic Lists 361  
              Dictionary 367  
              Modifying CardLib to Use a Generic Collection Class 369  
        Defining Generic Types 369  
           Defining Generic Classes 370  
              The default Keyword 372  
              Constraining Types 372  
              Inheriting from Generic Classes 378  
              Generic Operators 379  
              Generic Structs 380  
           Defining Generic Interfaces 380  
           Defining Generic Methods 381  
           Defining Generic Delegates 382  
        Variance 383  
           Covariance 384  
           Contravariance 384  
     Chapter 13: Additional C# Techniques 389  
        The :: Operator and the Global Namespace Qualifier 390  
        Custom Exceptions 391  
           Adding Custom Exceptions to CardLib 392  
        Events 393  
           What Is an Event? 393  
           Handling Events 395  
           Defining Events 398  
              Multipurpose Event Handlers 401  
              The EventHandler and Generic EventHandler Types 404  
              Return Values and Event Handlers 404  
              Anonymous Methods 405  
        Expanding and Using CardLib 405  
        Attributes 414  
           Reading Attributes 414  
           Creating Attributes 415  
        Initializers 416  
           Object Initializers 417  
           Collection Initializers 419  
        Type Inference 422  
        Anonymous Types 424  
        Dynamic Lookup 428  
           The dynamic Type 429  
        Advanced Method Parameters 432  
           Optional Parameters 433  
              Optional Parameter Values 434  
              The OptionalAttribute Attribute 434  
              Optional Parameter Order 434  
           Named Parameters 434  
        Lambda Expressions 439  
           Anonymous Methods Recap 439  
           Lambda Expressions for Anonymous Methods 440  
           Lambda Expression Parameters 443  
           Lambda Expression Statement Bodies 444  
           Lambda Expressions as Delegates and Expression Trees 445  
           Lambda Expressions and Collections 446  
  Part II: Windows Programming 453  
     Chapter 14: Basic Desktop Programming 455  
        XAML 456  
           Separation of Concerns 457  
           XAML in Action 457  
              Namespaces 458  
              Code-Behind Files 459  
        The Playground 459  
           WPF Controls 460  
           Properties 462  
              Dependency Properties 465  
              Attached Properties 465  
           Events 466  
              Handling Events 467  
              Routed Events 468  
              Routed Commands 468  
              Control Types 471  
        Control Layout 471  
           Basic Layout Concepts 471  
              Stack Order 472  
              Alignment, Margins, Padding, and Dimensions 472  
              Border 473  
              Visual Debugging Tools 473  
           Layout Panels 474  
              Canvas 474  
              DockPanel 476  
              StackPanel 478  
              WrapPanel 479  
              Grid 479  
        The Game Client 482  
           The About Window 483  
              Designing the User Interface 483  
              The Image Control 484  
              The Label Control 484  
              The TextBlock Control 484  
              The Button Control 485  
           The Options Window 488  
              The TextBox Control 489  
              The CheckBox Control 489  
              The RadioButton Control 490  
              The ComboBox Control 491  
              The TabControl 492  
              Handling Events in the Options Window 495  
           Data Binding 497  
              The DataContext 498  
              Binding to Local Objects 498  
              Static Binding to External Objects 499  
              Dynamic Binding to External Objects 500  
           Starting a Game with the Listbox Control 502  
     Chapter 15: Advanced Desktop Programming 509  
        Creating and Styling Controls 510  
           Styles 510  
           Templates 511  
           Triggers 513  
           Animations 514  
        WPF User Controls 515  
           Implementing Dependency Properties 516  
        The Main Window 529  
           The Menu Control 529  
           Routed Commands with Menus 529  
        Putting It All Together 534  
           Refactoring the Domain Model 534  
           The ViewModel 541  
           Completing the Game 549  
  Part III: Cloud and Cross-Platform Programming 561  
     Chapter 16: Basic Cloud Programming 563  
        The Cloud, Cloud Computing, and the Cloud Optimized Stack 564  
        Cloud Patterns and Best Practices 567  
        Using Microsoft Azure C# Libraries to Create a Storage Container 568  
        Creating an ASP.NET 4.7 Web Site That Uses the Storage Container 578  
     Chapter 17: Advanced Cloud Programming and Deployment 589  
        Creating an ASP.NET Web API 590  
        Deploying and Consuming an ASP.NET Web API on Microsoft Azure 594  
        Scaling an ASP.NET Web API on Microsoft Azure 602  
     Chapter 18: .NET Standard and .NET Core 609  
        Cross-Platform Basics and Key “Must Know” Terms 611  
        What Is .NET Standard, and Why Is It Needed? 613  
           Shared Project, PCL, and .NET Standard 614  
        Referencing and Targeting Frameworks 617  
        What is .NET Core? 618  
           Cross Platform 620  
           Open Source 621  
           Optimized for the Cloud 621  
           Performance 622  
           Modular Design 623  
           Self-Contained Deployment Model 625  
        Building and Packaging a .NET Standard Library 626  
        Building a .NET Core Application with Visual Studio 632  
        Porting from .NET Framework to .NET Core 635  
           Identifying Third-Party Dependencies 635  
           Understanding Which Features Are Not Available 636  
           Upgrading the Current .NET Framework Target 636  
           Choosing the Platforms to Target for the Program 636  
     Chapter 19: ASP.NET and ASP.NET Core 639  
        Overview of Web Applications 640  
        Which ASP.NET to Use and Why 641  
           ASP.NET Web Forms 643  
           ASP.NET MVC 644  
           ASP.NET Web API 647  
           ASP.NET Core 647  
           ASP.NET Web Site versus ASP.NET Web Application Project Types 648  
              File Structure 649  
              Compiling 649  
              Deployment 649  
        Using ASP.NET Web Forms 650  
           Server Controls 650  
           Input Validation 651  
           State Management 652  
           Authentication and Authorization 653  
        Creating ASP.NET Core Web Applications 657  
           IIS and Kestrel 658  
           Razor Syntax 658  
           Input Validation 659  
           State Management 660  
           Authentication and Authorization 661  
           Dependency Injection 662  
  Part IV: Data Access 669  
     Chapter 20: Files 671  
        File Classes for Input and Output 672  
           The File and Directory Classes 673  
           The FileInfo Class 674  
           The DirectoryInfo Class 676  
           Path Names and Relative Paths 676  
        Streams 677  
           Classes for Using Streams 677  
           The FileStream Object 678  
              File Position 680  
              Reading Data 680  
              Writing Data 683  
           The StreamWriter Object 685  
           The StreamReader Object 688  
              Reading Data 690  
           Asynchronous File Access 690  
           Reading and Writing Compressed Files 691  
        Monitoring the File System 694  
     Chapter 21: XML and JSON 703  
        XML Basics 704  
        JSON Basics 704  
        XML Schemas 705  
        XML Document Object Model 707  
           The XmlDocument Class 708  
           The XmlElement Class 708  
           Changing the Values of Nodes 713  
              Inserting New Nodes 714  
              Deleting Nodes 717  
              Selecting Nodes 719  
        Converting XML to JSON 719  
        Searching XML with XPath 721  
     Chapter 22: LINQ 727  
        LINQ to XML 728  
           LINQ to XML Functional Constructors 728  
           Working with XML Fragments 731  
        LINQ Providers 734  
        LINQ Query Syntax 735  
           Declaring a Variable for Results Using the var Keyword 736  
           Specifying the Data Source: from Clause 737  
           Specify Condition: where Clause 737  
           Selecting Items: select Clause 738  
           Finishing Up: Using the foreach Loop 738  
           Deferred Query Execution 738  
        LINQ Method Syntax 739  
           LINQ Extension Methods 739  
           Query Syntax versus Method Syntax 739  
           Lambda Expressions 740  
        Ordering Query Results 742  
        Understanding the orderby Clause 743  
        Querying a Large Data Set 744  
        Using Aggregate Operators 747  
        Using the Select Distinct Query 750  
        Ordering by Multiple Levels 753  
        Using Group Queries 755  
        Using Joins 757  
     Chapter 23: Databases 761  
        Using Databases 761  
        Installing SQL Server Express 762  
        Entity Framework 762  
        A Code First Database 763  
        But Where Is My Database? 770  
        Navigating Database Relationships 772  
        Handling Migrations 779  
        Creating and Querying XML from an Existing Database 780  
  Part V: Additional Techniques 789  
     Chapter 24: Windows Communication Foundation 791  
        What Is WCF? 792  
        WCF Concepts 793  
           WCF Communication Protocols 793  
           Addresses, Endpoints, and Bindings 794  
           Contracts 796  
           Message Patterns 797  
           Behaviors 797  
           Hosting 798  
        WCF Programming 798  
           The WCF Test Client 804  
           Defining WCF Service Contracts 807  
              Data Contracts 807  
              Service Contracts 808  
              Operation Contracts 808  
              Message Contracts 809  
              Fault Contracts 809  
           Self-Hosted WCF Services 814  
     Chapter 25: Universal Apps 823  
        Getting Started 824  
        Windows Universal Apps 825  
        App Concepts and Design 826  
           Screen Orientation 826  
           Menus and Toolbars 826  
           Tiles and Badges 826  
           App Lifetime 827  
           Lock Screen Apps 827  
        App Development 827  
           Adaptive Displays 827  
              Relative Panel 828  
              Adaptive Triggers 828  
              FlipView 830  
           Sandboxed Apps 835  
              Disk Access 836  
              Serialization, Streams, and Async Programming 836  
           Navigation between Pages 840  
           The CommandBar Control 842  
           Managing State 844  
        Common Elements of Windows Store Apps 846  
        The Windows Store 848  
           Packaging an App 848  
           Creating the Package 849  
  Appendix : Exercise Solutions 851  
     Chapter 3 Solutions 851  
        Exercise 1 851  
        Exercise 2 851  
        Exercise 3 851  
        Exercise 4 851  
        Exercise 5 851  
     Chapter 4 Solutions 852  
        Exercise 1 852  
        Exercise 2 852  
        Exercise 3 853  
     Chapter 5 Solutions 853  
        Exercise 1 853  
        Exercise 2 853  
        Exercise 3 853  
        Exercise 4 854  
        Exercise 5 854  
        Exercise 6 854  
     Chapter 6 Solutions 855  
        Exercise 1 855  
        Exercise 2 855  
        Exercise 3 855  
        Exercise 4 855  
        Exercise 5 856  
     Chapter 7 Solutions 856  
        Exercise 1 856  
        Exercise 2 856  
        Exercise 3 856  
        Exercise 4 857  
     Chapter 8 Solutions 857  
        Exercise 1 857  
        Exercise 2 857  
        Exercise 3 857  
        Exercise 4 858  
        Exercise 5 858  
     Chapter 9 Solutions 859  
        Exercise 1 859  
        Exercise 2 859  
        Exercise 3 859  
        Exercise 4 859  
        Exercise 5 860  
     Chapter 10 Solutions 861  
        Exercise 1 861  
        Exercise 2 861  
        Exercise 3 861  
        Exercise 4 861  
        Exercise 5 862  
     Chapter 11 Solutions 863  
        Exercise 1 863  
        Exercise 2 864  
        Exercise 3 864  
        Exercise 4 865  
        Exercise 5 866  
     Chapter 12 Solutions 866  
        Exercise 1 866  
        Exercise 2 866  
        Exercise 3 867  
        Exercise 4 867  
        Exercise 5 867  
        Exercise 6 869  
     Chapter 13 Solutions 869  
        Exercise 1 869  
        Exercise 2 870  
        Exercise 3 874  
        Exercise 4 874  
        Exercise 5 875  
        Exercise 6 875  
        Exercise 7 875  
        Exercise 8 875  
     Chapter 14 Solutions 875  
        Exercise 1 875  
        Exercise 2 876  
        Exercise 3 876  
        Exercise 4 877  
     Chapter 15 Solutions 878  
        Exercise 1 878  
        Exercise 2 880  
        Exercise 3 880  
     Chapter 16 Solutions 881  
        Exercise 1 881  
        Exercise 2 882  
     Chapter 17 Solutions 882  
        Exercise 1 882  
        Exercise 2 883  
     Chapter 20 Solutions 883  
        Exercise 1 883  
        Exercise 2 883  
        Exercise 3 883  
        Exercise 4 883  
        Exercise 5 884  
        Exercise 6 884  
     Chapter 21 Solutions 884  
        Exercise 1 884  
        Exercise 2 884  
        Exercise 3 884  
        Exercise 4 885  
     Chapter 22 Solutions 885  
        Exercise 1 885  
        Exercise 2 886  
        Exercise 3 886  
        Exercise 4 887  
        Exercise 5 887  
        Exercise 6 888  
     Chapter 23 Solutions 888  
        Exercise 1 888  
        Exercise 2 889  
        Exercise 3 889  
        Exercise 4 890  
     Chapter 24 Solutions 892  
        Exercise 1 892  
        Exercise 2 892  
        Exercise 3 892  
        Exercise 4 892  
        Exercise 5 892  
     Chapter 25 Solutions 893  
        Exercise 1 893  
        Exercise 2 894  
  Index 895  
  EULA 915  


nach oben


  Mehr zum Inhalt
Kapitelübersicht
Kurzinformation
Inhaltsverzeichnis
Leseprobe
Blick ins Buch
Fragen zu eBooks?

  Navigation
Belletristik / Romane
Computer
Geschichte
Kultur
Medizin / Gesundheit
Philosophie / Religion
Politik
Psychologie / Pädagogik
Ratgeber
Recht
Reise / Hobbys
Technik / Wissen
Wirtschaft

© 2008-2024 ciando GmbH | Impressum | Kontakt | F.A.Q. | Datenschutz