
Programming C# 4.0
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
More details
Other editions
Additional editions

Content
- Intro
- Table of Contents
- Preface
- How This Book Is Organized
- Where to Find Features New in C# 4.0 and .NET 4
- Who This Book Is For
- What You Need to Use This Book
- Conventions Used in This Book
- Using Code Examples
- Safari® Books Online
- Acknowledgments
- From Ian Griffiths
- From Matthew Adams
- Chapter 1. Introducing C#
- Why C#? Why .NET?
- The .NET Framework Class Library
- Language Style
- Composability
- Managed Code
- Continuity and the Windows Ecosystem
- C# 4.0, .NET 4, and Visual Studio 2010
- Summary
- Chapter 2. Basic Programming Techniques
- Getting Started
- Namespaces and Types
- Projects and Solutions
- Comments, Regions, and Readability
- Bad Comments
- XML Documentation Comments
- Variables
- Variable Types
- Integers
- Floating point
- Decimal floating point
- Expressions and Statements
- Assignment Statements
- Increment and Decrement Operators
- Flow Control with Selection Statements
- if Statements
- if...else
- switch and case Statements
- Iteration Statements
- foreach Statements
- for Statements
- while and do Statements
- Breaking Out of a Loop
- Methods
- Summary
- Chapter 3. Abstracting Ideas with Classes and Structs
- Divide and Conquer
- Abstracting Ideas with Methods
- Abstracting Ideas with Objects and Classes
- Object-oriented analysis
- Defining Classes
- Representing State with Properties
- Protection Levels
- Initializing with a Constructor
- Fields: A Place to Put Data
- Fields Can Be Fickle, but const Is Forever
- Read-only Fields and Properties
- Related Constants with enum
- Value Types and Reference Types
- Too Many Constructors, Mr. Mozart
- Overloading
- Overloaded Methods and Default Named Parameters
- Object Initializers
- Defining Methods
- Declaring Static Methods
- Static Fields and Properties
- Static Constructors
- Summary
- Chapter 4. Extensibility and Polymorphism
- Association Through Composition and Aggregation
- Inheritance and Polymorphism
- Replacing Methods in Derived Classes
- Hiding Base Members with new
- Replacing Methods with virtual and override
- Inheritance and Protection
- Calling Base Class Methods
- Thus Far and No Farther: sealed
- Requiring Overrides with abstract
- All Types Are Derived from Object
- Boxing and Unboxing Value Types
- C# Does Not Support Multiple Inheritance of Implementation
- C# Supports Multiple Inheritance of Interface
- Deriving Interfaces from Other Interfaces
- Explicit Interface Implementation
- The Last Resort: Checking Types at Runtime
- Summary
- Chapter 5. Composability and Extensibility with Delegates
- Functional Composition with delegate
- Generic Actions with Action&T&
- Generic Predicates with Predicate&T&
- Using Anonymous Methods
- Creating Delegates with Lambda Expressions
- Delegates in Properties
- Generic Delegates for Functions
- Notifying Clients with Events
- Exposing Large Numbers of Events
- Summary
- Chapter 6. Dealing with Errors
- When and How to Fail
- Returning Error Values
- Debugging with Return Values
- Exceptions
- Handling Exceptions
- When Do finally Blocks Run?
- Deciding What to Catch
- Custom Exceptions
- Summary
- Chapter 7. Arrays and Lists
- Arrays
- Construction and Initialization
- Array arguments and the params keyword
- Custom Types in Arrays
- Array Members
- Finding elements
- Ordering elements
- Moving or copying elements
- Array Size
- Arrays of arrays (or jagged arrays)
- Rectangular arrays
- List&T&
- Custom Indexers
- Immutability and List&T&
- Finding and Sorting
- Collections and Polymorphism
- Creating Your Own IEnumerable&T&
- Lazy collections
- Summary
- Chapter 8. LINQ
- Query Expressions
- Query Expressions Versus Method Calls
- Extension Methods and LINQ
- let Clauses
- LINQ Concepts and Techniques
- Delegates and Lambdas
- Functional Style and Composition
- Deferred Execution
- LINQ Operators
- Filtering
- Ordering
- Concatenation
- Grouping
- Projections
- Anonymous types
- Using multiple sources
- Numbering items
- Zipping
- Getting Selective
- Testing the Whole Collection
- Aggregation
- Set Operations
- Joining
- Conversions
- Summary
- Chapter 9. Collection Classes
- Dictionaries
- Common Dictionary Uses
- Looking up values
- Caching
- Dynamic properties
- Sparse arrays
- IDictionary&TKey, TValue&
- Dictionaries and LINQ
- HashSet and SortedSet
- Queues
- Linked Lists
- Stacks
- Summary
- Chapter 10. Strings
- What Is a String?
- The String and Char Types
- Literal Strings and Chars
- Escaping Special Characters
- Formatting Data for Output
- Standard Numeric Format Strings
- Currency
- Decimal
- Hexadecimal
- Exponential form
- Fixed point
- General
- Numeric
- Percent
- Round trip
- Custom Numeric Format Strings
- Dates and Times
- Going the Other Way: Converting Strings to Other Types
- Composite Formatting with String.Format
- Culture Sensitivity
- Exploring Formatting Rules
- Accessing Characters by Index
- Strings Are Immutable
- Getting a Range of Characters
- Composing Strings
- Splitting It Up Again
- Upper- and Lowercase
- Manipulating Text
- Mutable Strings with StringBuilder
- Finding and Replacing Content
- All Sorts of "Empty" Strings
- Trimming Whitespace
- Checking Character Types
- Encoding Characters
- Why Encodings Matter
- Encoding and Decoding
- Why Represent Strings As Byte Sequences?
- Summary
- Chapter 11. Files and Streams
- Inspecting Directories and Files
- Examining Directories
- Manipulating File Paths
- Path and the Current Working Directory
- Examining File Information
- Creating Temporary Files
- Deleting Files
- Well-Known Folders
- Concatenating Path Elements Safely
- Creating and Securing Directory Hierarchies
- Deleting a Directory
- Writing Text Files
- Writing a Whole Text File at Once
- Writing Text with a StreamWriter
- When Files Go Bad: Dealing with Exceptions
- Finding and Modifying Permissions
- Reading Files into Memory
- Streams
- Moving Around in a Stream
- Writing Data with Streams
- Reading, Writing, and Locking Files
- FileStream Constructors
- Stream Buffers
- Setting Permissions During Construction
- Setting Advanced Options
- Asynchronous File Operations
- Isolated Storage
- Stores
- Reading and Writing Text
- Defining "Isolated"
- Isolation by user and assembly
- Isolation by user, domain, and assembly
- Isolation by user and application
- Machine isolation
- Managing User Storage with Quotas
- Managing Isolated Storage
- Streams That Aren't Files
- An Adapting Stream: CryptoStream
- In Memory Alone: The MemoryStream
- Representing Binary As Text with Base64 Encoding
- Summary
- Chapter 12. XML
- XML Basics (A Quick Review)
- Elements
- XHTML
- X Stands for eXtensible
- Creating XML Documents
- XML Elements
- XML Attributes
- Putting the LINQ in LINQ to XML
- Searching in XML with LINQ
- Searching for a Single Node
- Search Axes
- Where Clauses
- XML Serialization
- Customizing XML Serialization Using Attributes
- Summary
- Chapter 13. Networking
- Choosing a Networking Technology
- Web Application with Client-Side Code
- .NET Client and .NET Server
- Tightly controlled deployment
- Weakly controlled deployment
- .NET Client and External Party Web Service
- External Client and .NET Web Service
- WCF
- Creating a WCF Project
- WCF Contracts
- WCF Test Client and Host
- Hosting a WCF Service
- WCF configuration
- Writing a WCF Client
- Sharing contracts
- Proxy
- Bidirectional Communication with Duplex Contracts
- Session-based communication
- Calling the client from the server
- Server configuration for duplex and sessions
- Duplex client
- HTTP
- WebClient
- Downloading resources
- Uploading resources
- Stream-based uploads and downloads
- WebRequest and WebResponse
- Authentication
- Working with proxies
- Controlling cache behavior
- Using cookies
- Sockets
- IP, IPv6, and TCP
- Connecting to Services with the Socket Class
- Implementing Services with the Socket Class
- Other Networking Features
- Summary
- Chapter 14. Databases
- The .NET Data Access Landscape
- Classic ADO.NET
- IDataReader and friends
- ADO.NET data sets
- LINQ and Databases
- Non-Microsoft Data Access Technologies
- WCF Data Services
- Silverlight and Data Access
- Databases
- Getting up and running with SQL Server 2008 Express
- The Entity Data Model
- Generated Code
- Changing the Mapping
- Relationships
- Navigation properties
- Multiplicity
- Inheritance
- Queries
- LINQ to Entities
- Entity SQL
- Mixing ESQL and LINQ
- The EntityClient ADO.NET Provider
- Object Context
- Connection Handling
- Creating, Updating, and Deleting
- Transactions
- Optimistic Concurrency
- Context and Entity Lifetime
- WCF Data Services
- Summary
- Chapter 15. Assemblies
- .NET Components: Assemblies
- References
- Writing Libraries
- Protection
- Internal protection
- Naming
- Signing and Strong Names
- Loading
- Loading from the Application Folder
- Loading from the GAC
- Loading from a Silverlight .xap File
- Explicit Loading
- Unloading
- Summary
- Chapter 16. Threads and Asynchronous Code
- Threads
- Threads and the OS Scheduler
- The Stack
- The Thread Pool
- Thread Affinity and Context
- Common Thread Misconceptions
- Myth: Threads are necessary to get work done
- Myth: Multiple logical processors will necessarily make things faster
- Myth: Maxing the CPU must mean we're going really fast
- Multithreaded Coding Is Hard
- Race conditions
- Deadlocks and livelocks
- Multithreading Survival Strategies
- Abstinence
- Isolation
- Immutability
- Synchronization
- Synchronization Primitives
- Monitor
- Notification
- Other Lock Types
- SpinLock
- Reader/writer locks
- Mutexes
- Other Coordination Mechanisms
- Events
- Countdown
- BlockingCollection
- Asynchronous Programming
- The Asynchronous Programming Model
- The Event-Based Asynchronous Pattern
- Ad Hoc Asynchrony
- The Task Parallel Library
- Tasks
- Parent-child relationships
- Fine-grained concurrency
- Tasks with results
- Continuations
- Schedulers
- Tasks and the Asynchronous Programming Model
- Cancellation
- Error Handling
- Data Parallelism
- Parallel For and ForEach
- PLINQ: Parallel LINQ
- Summary
- Chapter 17. Attributes and Reflection
- Attributes
- Types of Attributes
- Attribute targets
- Applying attributes
- Custom Attributes
- Defining a custom attribute
- Naming an attribute
- Constructing an attribute
- Using an attribute
- Reflection
- Inspecting Metadata
- Type Discovery
- Reflecting on a Specific Type
- Finding all type members
- Finding type methods
- Late Binding
- Summary
- Chapter 18. Dynamic
- Static Versus Dynamic
- The Dynamic Style and COM Automation
- The dynamic Type
- Object Types and dynamic
- COM objects
- Silverlight script objects
- Ordinary .NET objects
- Objects from other dynamic languages
- ExpandoObject
- Custom dynamic objects
- dynamic in Noninterop Scenarios?
- Summary
- Chapter 19. Interop with COM and Win32
- Importing ActiveX Controls
- Importing a Control in .NET
- Interop Assemblies
- No PIA
- 64-bit Versus 32-bit
- P/Invoke
- Pointers
- C# 4.0 Interop Syntax Enhancements
- Indexed Properties
- Optional ref
- Summary
- Chapter 20. WPF and Silverlight
- Xaml and Code Behind
- Xaml and Objects
- Elements and Controls
- Layout Panels
- General-purpose layout properties
- Transforms
- Graphical Elements
- Shapes
- Images
- Media
- Animation
- 3D graphics
- Controls
- Content controls
- Items controls
- User Controls
- Control Templates
- Styles
- The Visual State Manager
- Data Binding
- Data Templates
- Summary
- Chapter 21. Programming ASP.NET Applications
- Web Forms Fundamentals
- Web Forms Events
- Postback versus nonpostback events
- View state
- Web Forms Life Cycle
- Creating a Web Application
- Code-Behind Files
- Adding Controls
- Server Controls
- Data Binding
- Examining the Code
- Adding Controls and Events
- Summary
- Chapter 22. Windows Forms
- Creating the Application
- Adding a Binding Source
- Controls
- Docking and Anchoring
- Data Binding
- Event Handling
- Summary
- Index
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.