Details

Beginning C# 6 Programming with Visual Studio 2015


Beginning C# 6 Programming with Visual Studio 2015


1. Aufl.

von: Benjamin Perkins, Jacob Vibe Hammer, Jon D. Reid

32,99 €

Verlag: Wiley
Format: PDF
Veröffentl.: 15.12.2015
ISBN/EAN: 9781119096566
Sprache: englisch
Anzahl Seiten: 848

DRM-geschütztes eBook, Sie benötigen z.B. Adobe Digital Editions und eine Adobe ID zum Lesen.

Beschreibungen

<b>Get started with Visual C# programming with this great beginner's guide</b> <p><i>Beginning C# 6 Programming</i> <i>with Visual Studio 2015</i> provides step-by-step directions for programming with C# in the .NET framework. Beginning with programming essentials, such as variables, flow control, and object-oriented programming, this authoritative text moves into more complicated topics, such as web and Windows programming and data access within both database and XML environments. After your introduction to each of the chapters, you are invited to apply your newfound knowledge in Try it Out sections, which reinforce learning and help you understand the practical applications of the new concepts you have explored. Through this approach, you can write useful programming code following each of the steps that you explore in this essential text.</p> <ul> <li>Discover the basics of programming with C#, such as variables, expressions, flow control, and functions</li> <li>Discuss how to keep your program running smoothly through debugging and error handling</li> <li>Understand how to navigate your way through key programming elements, such as classes, class members, collections, comparisons, and conversions</li> <li>Explore object-oriented programming, web programming, and Windows programming</li> </ul> <p><i>Beginning C# 6 Programming with Visual Studio 2015</i> is a fundamental resource for any programmers who are new to the C# language.</p>
INTRODUCTION xix <p><b>PART I: THE OOP LANGUAGE</b></p> <p><b>CHAPTER 1: INTRODUCING C# 3</b></p> <p>What Is the .NET Framework? 4</p> <p>What’s in the .NET Framework? 4</p> <p>Writing Applications Using the .NET Framework 5</p> <p>What Is C#? 8</p> <p>Applications You Can Write with C# 9</p> <p>C# in this Book 10</p> <p>Visual Studio 2015 10</p> <p>Visual Studio Express 2015 Products 10</p> <p>Solutions 11</p> <p><b>CHAPTER 2: WRITING A C# PROGRAM 13</b></p> <p>The Visual Studio 2015 Development Environment 14</p> <p>Console Applications 17</p> <p>The Solution Explorer 20</p> <p>The Properties Window 21</p> <p>The Error List Window 22</p> <p>Desktop Applications 22</p> <p><b>CHAPTER 3: VARIABLES AND EXPRESSIONS 29</b></p> <p>Basic C# Syntax 30</p> <p>Basic C# Console Application Structure 33</p> <p>Variables 34</p> <p>Simple Types 34</p> <p>Variable Naming 39</p> <p>Literal Values 39</p> <p>Expressions 42</p> <p>Mathematical Operators 42</p> <p>Assignment Operators 47</p> <p>Operator Precedence 48</p> <p>Namespaces 49</p> <p><b>CHAPTER 4: FLOW CONTROL 53</b></p> <p>Boolean Logic 54</p> <p>Boolean Bitwise and Assignment Operators 56</p> <p>Operator Precedence Updated 58</p> <p>Branching 59</p> <p>The Ternary Operator 59</p> <p>The if Statement 59</p> <p>The switch Statement 63</p> <p>Looping 66</p> <p>do Loops 66</p> <p>while Loops 69</p> <p>for Loops 71</p> <p>Interrupting Loops 72</p> <p>Infinite Loops 73</p> <p><b>CHAPTER 5: MORE ABOUT VARIABLES 77</b></p> <p>Type Conversion 78</p> <p>Implicit Conversions 78</p> <p>Explicit Conversions 80</p> <p>Explicit Conversions Using the Convert Commands 83</p> <p>Complex Variable Types 85</p> <p>Enumerations 85</p> <p>Structs 89</p> <p>Arrays 92</p> <p>String Manipulation 99</p> <p><b>CHAPTER 6: FUNCTIONS 107</b></p> <p>Defining and Using Functions 108</p> <p>Return Values 110</p> <p>Parameters 112</p> <p>Variable Scope 119</p> <p>Variable Scope in Other Structures 122</p> <p>Parameters and Return Values versus Global Data 123</p> <p>The Main() Function 125</p> <p>Struct Functions 127</p> <p>Overloading Functions 128</p> <p>Using Delegates 130</p> <p><b>CHAPTER 7: DEBUGGING AND ERROR HANDLING 135</b></p> <p>Debugging in Visual Studio 136</p> <p>Debugging in Nonbreak (Normal) Mode 136</p> <p>Debugging in Break Mode 144</p> <p>Error Handling 153</p> <p>try…catch…finally 153</p> <p>Listing and Configuring Exceptions 160</p> <p><b>CHAPTER 8: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING 163</b></p> <p>What Is Object-Oriented Programming? 164</p> <p>What Is an Object? 165</p> <p>Everything’s an Object 168</p> <p>The Life Cycle of an Object 168</p> <p>Static and Instance Class Members 169</p> <p>OOP Techniques 170</p> <p>Interfaces 171</p> <p>Inheritance 172</p> <p>Polymorphism 175</p> <p>Relationships between Objects 177</p> <p>Operator Overloading 179</p> <p>Events 180</p> <p>Reference Types versus Value Types 180</p> <p>OOP in Desktop Applications 180</p> <p><b>CHAPTER 9: DEFINING CLASSES 187</b></p> <p>Class Definitions in C# 188</p> <p>Interface Definitions 190</p> <p>System.Object 193</p> <p>Constructors and Destructors 195</p> <p>Constructor Execution Sequence 196</p> <p>OOP Tools in Visual Studio 200</p> <p>The Class View Window 200</p> <p>The Object Browser 202</p> <p>Adding Classes 203</p> <p>Class Diagrams 204</p> <p>Class Library Projects 206</p> <p>Interfaces versus Abstract Classes 209</p> <p>Struct Types 212</p> <p>Shallow Copying versus Deep Copying 214</p> <p><b>CHAPTER 10: DEFINING CLASS MEMBERS 217</b></p> <p>Member Definitions 218</p> <p>Defining Fields 218</p> <p>Defining Methods 219</p> <p>Defining Properties 220</p> <p>Refactoring Members 225</p> <p>Automatic Properties 226</p> <p>Additional Class Member Topics 227</p> <p>Hiding Base Class Methods 227</p> <p>Calling Overridden or Hidden Base Class Methods 229</p> <p>Using Nested Type Defi nitions 230</p> <p>Interface Implementation 232</p> <p>Implementing Interfaces in Classes 233</p> <p>Partial Class Definitions 235</p> <p>Partial Method Definitions 237</p> <p>Example Application 238</p> <p>Planning the Application 238</p> <p>Writing the Class Library 239</p> <p>A Client Application for the Class Library 246</p> <p>The Call Hierarchy Window 248</p> <p><b>CHAPTER 11: COLLECTIONS, COMPARISONS, AND CONVERSIONS 251</b></p> <p>Collections 252</p> <p>Using Collections 253</p> <p>Defining Collections 258</p> <p>Indexers 259</p> <p>Adding a Cards Collection to CardLib 262</p> <p>Keyed Collections and IDictionary 264</p> <p>Iterators 266</p> <p>Iterators and Collections 270</p> <p>Deep Copying 271</p> <p>Adding Deep Copying to CardLib 273</p> <p>Comparisons 275</p> <p>Type Comparisons 275</p> <p>Value Comparisons 279</p> <p>Conversions 295</p> <p>Overloading Conversion Operators 295</p> <p>The as Operator 297</p> <p><b>CHAPTER 12: GENERICS 301</b></p> <p>What Are Generics? 302</p> <p>Using Generics 303</p> <p>Nullable Types 303</p> <p>The System.Collections.Generic Namespace 311</p> <p>Defining Generic Types 321</p> <p>Defining Generic Classes 322</p> <p>Defining Generic Interfaces 332</p> <p>Defining Generic Methods 333</p> <p>Defining Generic Delegates 334</p> <p>Variance 335</p> <p>Covariance 336</p> <p>Contravariance 336</p> <p><b>CHAPTER 13: ADDITIONAL C# TECHNIQUES 341</b></p> <p>The : : Operator and the Global Namespace Qualifi er 342</p> <p>Custom Exceptions 343</p> <p>Adding Custom Exceptions to CardLib 343</p> <p>Events 345</p> <p>What Is an Event? 345</p> <p>Handling Events 347</p> <p>Defining Events 350</p> <p>Expanding and Using CardLib 357</p> <p>Attributes 365</p> <p>Reading Attributes 366</p> <p>Creating Attributes 367</p> <p>Initializers 368</p> <p>Object Initializers 368</p> <p>Collection Initializers 371</p> <p>Type Inference 374</p> <p>Anonymous Types 376</p> <p>Dynamic Lookup 380</p> <p>The dynamic Type 381</p> <p>Advanced Method Parameters 384</p> <p>Optional Parameters 385</p> <p>Named Parameters 386</p> <p>Lambda Expressions 391</p> <p>Anonymous Methods Recap 391</p> <p>Lambda Expressions for Anonymous Methods 392</p> <p>Lambda Expression Parameters 396</p> <p>Lambda Expression Statement Bodies 396</p> <p>Lambda Expressions as Delegates and Expression Trees 398</p> <p>Lambda Expressions and Collections 399</p> <p>PART II: WINDOWS PROGRAMMING</p> <p><b>CHAPTER 14: BASIC DESKTOP PROGRAMMING 407</b></p> <p>XAML 408</p> <p>Separation of Concerns 409</p> <p>XAML in Action 409</p> <p>The Playground 411</p> <p>WPF Controls 412</p> <p>Properties 413</p> <p>Events 417</p> <p>Control Layout 422</p> <p>Stack Order 423</p> <p>Alignment, Margins, Padding, and Dimensions 423</p> <p>Border 424</p> <p>Canvas 424</p> <p>DockPanel 426</p> <p>StackPanel 428</p> <p>WrapPanel 429</p> <p>Grid 430</p> <p>The Game Client 433</p> <p>The About Window 433</p> <p>The Options Window 439</p> <p>Data Binding 448</p> <p>Starting a Game with the ListBox Control 453</p> <p><b>CHAPTER 15: ADVANCED DESKTOP PROGRAMMING 461</b></p> <p>The Main Window 462</p> <p>The Menu Control 462</p> <p>Routed Commands with Menus 462</p> <p>Creating and Styling Controls 466</p> <p>Styles 467</p> <p>Templates 467</p> <p>Value Converters 472</p> <p>Triggers 473</p> <p>Animations 475</p> <p>WPF User Controls 478</p> <p>Implementing Dependency Properties 478</p> <p>Putting It All Together 489</p> <p>Refactoring the Domain Model 489</p> <p>The View Models 494</p> <p>Completing the Game 502</p> <p><b>PART III: CLOUD PROGRAMMING</b></p> <p><b>CHAPTER 16: BASIC CLOUD PROGRAMMING 515</b></p> <p>The Cloud, Cloud Computing, and the Cloud Optimized Stack 516</p> <p>Cloud Patterns and Best Practices 519</p> <p>Using Microsoft Azure C# Libraries to Create a Storage Container 520</p> <p>Creating an ASP.NET 4.6 Web Site That Uses the Storage Container 530</p> <p><b>CHAPTER 17: ADVANCED CLOUD PROGRAMING AND DEPLOYMENT 539</b></p> <p>Creating an ASP.NET Web API 540</p> <p>Deploying and Consuming an ASP.NET Web API on Microsoft Azure 544</p> <p>Scaling an ASP.NET Web API on Microsoft Azure 551</p> <p><b>PART IV: DATA ACCESS</b></p> <p><b>CHAPTER 18: FILES 561</b></p> <p>File Classes for Input and Output 562</p> <p>The File and Directory Classes 563</p> <p>The FileInfo Class 564</p> <p>The DirectoryInfo Class 566</p> <p>Path Names and Relative Paths 566</p> <p>Streams 567</p> <p>Classes for Using Streams 567</p> <p>The FileStream Object 568</p> <p>The StreamWriter Object 575</p> <p>The StreamReader Object 577</p> <p>Asynchronous File Access 580</p> <p>Reading and Writing Compressed Files 580</p> <p>Monitoring the File System 584</p> <p><b>CHAPTER 19: XML AND JSON 593</b></p> <p>XML Basics 594</p> <p>JSON Basics 594</p> <p>XML Schemas 595</p> <p>XML Document Object Model 597</p> <p>The XmlDocument Class 598</p> <p>The XmlElement Class 598</p> <p>Changing the Values of Nodes 603</p> <p>Converting XML to JSON 609</p> <p>Searching XML with XPath 611</p> <p><b>CHAPTER 20: LINQ 617</b></p> <p>LINQ to XML 618</p> <p>LINQ to XML Functional Constructors 618</p> <p>Working with XML Fragments 621</p> <p>LINQ Providers 624</p> <p>LINQ Query Syntax 624</p> <p>Declaring a Variable for Results Using the var Keyword 626</p> <p>Specifying the Data Source: from Clause 627</p> <p>Specify Condition: where Clause 627</p> <p>Selecting Items: select Clause 627</p> <p>Finishing Up: Using the foreach Loop 628</p> <p>Deferred Query Execution 628</p> <p>LINQ Method Syntax 628</p> <p>LINQ Extension Methods 629</p> <p>Query Syntax versus Method Syntax 629</p> <p>Lambda Expressions 630</p> <p>Ordering Query Results 632</p> <p>Understanding the orderby Clause 633</p> <p>Querying a Large Data Set 634</p> <p>Using Aggregate Operators 636</p> <p>Using the Select Distinct Query 640</p> <p>Ordering by Multiple Levels 642</p> <p>Using Group Queries 644</p> <p>Using Joins 646</p> <p><b>CHAPTER 21: DATABASES 651</b></p> <p>Using Databases 651</p> <p>Installing SQL Server Express 652</p> <p>Entity Framework 652</p> <p>A Code First Database 653</p> <p>But Where Is My Database? 660</p> <p>Navigating Database Relationships 661</p> <p>Handling Migrations 668</p> <p>Creating and Querying XML from an</p> <p>Existing Database 669</p> <p><b>PART V: ADDITIONAL TECHNIQUES</b></p> <p><b>CHAPTER 22: WINDOWS COMMUNICATION FOUNDATION 677</b></p> <p>What Is WCF? 678</p> <p>WCF Concepts 679</p> <p>WCF Communication Protocols 679</p> <p>Addresses, Endpoints, and Bindings 680</p> <p>Contracts 682</p> <p>Message Patterns 683</p> <p>Behaviors 683</p> <p>Hosting 683</p> <p>WCF Programming 684</p> <p>The WCF Test Client 690</p> <p>Defining WCF Service Contracts 693</p> <p>Self-Hosted WCF Services 700</p> <p><b>CHAPTER 23: UNIVERSAL APPS 709</b></p> <p>Getting Started 709</p> <p>Universal Apps 710</p> <p>App Concepts and Design 711</p> <p>Screen Orientation 711</p> <p>Menus and Toolbars 711</p> <p>Tiles and Badges 712</p> <p>App Lifetime 712</p> <p>Lock Screen Apps 712</p> <p>App Development 712</p> <p>Adaptive Displays 713</p> <p>Sandboxed Apps 721</p> <p>Navigation between Pages 725</p> <p>The CommandBar Control 728</p> <p>Managing State 729</p> <p>Common Elements of Windows Store Apps 732</p> <p>The Windows Store 733</p> <p>Packaging an App 733</p> <p>Creating the Package 734</p> <p>APPENDIX: EXERCISE SOLUTIONS 737</p> <p>INDEX 781</p>
<p><b>About the authors</b></p> <p><b>Benjamin Perkins</b> is Senior Support Escalation Engineer at Microsoft, and an avid C# programmer with 15 years experience in enterprise-level IT solutions.</p> <p><b>Jacob Vibe Hammer</b> is a software engineer at Terma and co-author of a number of .NET books.</p> <p><b>Jon D. Reid</b> is a Product Solution Manager for IFS R&D (www.ifsworld.com) where he develops in C# for the Microsoft environment.</p>
<p><b>The hands-on guide to C# and programming with Visual Studio 2015</b> <p>This book is the ideal beginner's guide to C# 6 programming and the .NET framework. Coverage starts with the very basics of object oriented programming, assuming no prior programming experience, and step-by-step hands-on tutorials focus on the tools beginners use most. Practical exercises utilize the C# environment in Visual Studio 2015, and includes the latest changes and updates as Microsoft pushes to make C# more compatible with other programming languages. With expert instruction from veteran Microsoft developers, this book will have complete beginners programming Windows and Web apps in no time! <p><i>Beginning C# 6 Programming with Visual Studio 2015:</i> <ul> <li>Begins with the absolute basics, such as variables, flow control, object oriented programming, classes, functions, collections, comparisons, conversions, and more</li> <li>Focuses on the beginner favorite Visual C#<sup>®</sup> 6 development environment in Visual Studio 2015, covering all of the latest updates and language changes</li> <li>Includes intermediate instruction on Cloud and Windows<sup>®</sup> programming, including databases and XML</li> <li>Demystifies error handling techniques and debugging processes</li> <li>Features expert-led step-by-step tutorials to help beginners write useful code in real-world programming scenarios</li> </ul> <p><b>Wrox Beginning</b> guides are crafted to make learning programming languages and technologies easier than you think, providing a structured, tutorial format that will guide you through all the techniques involved. <p>Visit us at wrox.com where you have access to free code samples, Programmer to Programmer forums, and discussions on the latest happenings in the industry from around the world.

Diese Produkte könnten Sie auch interessieren:

Software Process Modeling
Software Process Modeling
von: Silvia T. Acuna, Natalia Juristo
PDF ebook
96,29 €
A Software Process Model Handbook for Incorporating People's Capabilities
A Software Process Model Handbook for Incorporating People's Capabilities
von: Silvia T. Acuna, Natalia Juristo, Ana Maria Moreno, Alicia Mon
PDF ebook
149,79 €
XML for Bioinformatics
XML for Bioinformatics
von: Ethan Cerami
PDF ebook
53,49 €