Mutable strings with stringbuilder 349 finding and

Info icon This preview shows pages 11–15. Sign up to view the full content.

View Full Document Right Arrow Icon
Mutable Strings with StringBuilder 349 Finding and Replacing Content 353 All Sorts of “Empty” Strings 355 Trimming Whitespace 357 Checking Character Types 360 Encoding Characters 360 Why Encodings Matter 362 Encoding and Decoding 363 Why Represent Strings As Byte Sequences? 370 Summary 370 11. Files and Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 Inspecting Directories and Files 371 Examining Directories 374 Manipulating File Paths 375 Path and the Current Working Directory 376 Examining File Information 377 Creating Temporary Files 381 Deleting Files 381 Well-Known Folders 383 Concatenating Path Elements Safely 387 Creating and Securing Directory Hierarchies 388 Deleting a Directory 394 Writing Text Files 396 Writing a Whole Text File at Once 396 Writing Text with a StreamWriter 397 When Files Go Bad: Dealing with Exceptions 400 Finding and Modifying Permissions 404 Reading Files into Memory 409 Streams 413 Moving Around in a Stream 419 Writing Data with Streams 421 Reading, Writing, and Locking Files 422 FileStream Constructors 423 Stream Buffers 423 Table of Contents | ix
Image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Setting Permissions During Construction 424 Setting Advanced Options 425 Asynchronous File Operations 425 Isolated Storage 428 Stores 429 Reading and Writing Text 430 Defining “Isolated” 431 Managing User Storage with Quotas 436 Managing Isolated Storage 436 Streams That Aren’t Files 439 An Adapting Stream: CryptoStream 443 In Memory Alone: The MemoryStream 444 Representing Binary As Text with Base64 Encoding 444 Summary 447 12. XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 XML Basics (A Quick Review) 449 Elements 450 XHTML 451 X Stands for eXtensible 452 Creating XML Documents 452 XML Elements 455 XML Attributes 456 Putting the LINQ in LINQ to XML 459 Searching in XML with LINQ 461 Searching for a Single Node 465 Search Axes 466 Where Clauses 466 XML Serialization 467 Customizing XML Serialization Using Attributes 469 Summary 471 13. Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 Choosing a Networking Technology 473 Web Application with Client-Side Code 474 .NET Client and .NET Server 477 .NET Client and External Party Web Service 479 External Client and .NET Web Service 480 WCF 481 Creating a WCF Project 481 WCF Contracts 482 WCF Test Client and Host 483 Hosting a WCF Service 486 x | Table of Contents
Image of page 12
Writing a WCF Client 493 Bidirectional Communication with Duplex Contracts 501 HTTP 511 WebClient 512 WebRequest and WebResponse 516 Sockets 522 IP, IPv6, and TCP 523 Connecting to Services with the Socket Class 528 Implementing Services with the Socket Class 531 Other Networking Features 536 Summary 537 14. Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 The .NET Data Access Landscape 539 Classic ADO.NET 540 LINQ and Databases 544 Non-Microsoft Data Access Technologies 545 WCF Data Services 546 Silverlight and Data Access 546 Databases 547 The Entity Data Model 548 Generated Code 551 Changing the Mapping 554 Relationships 555 Inheritance 562 Queries 563 LINQ to Entities 563 Entity SQL 568 Mixing ESQL and LINQ 570 The EntityClient ADO.NET Provider 571 Object Context 571 Connection Handling 571 Creating, Updating, and Deleting 574 Transactions 576 Optimistic Concurrency 581 Context and Entity Lifetime 583 WCF Data Services 584 Summary 588 15. Assemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 .NET Components: Assemblies 589 References 590 Writing Libraries 593 Table of Contents | xi
Image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Protection 595
Image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern