Programming C# 4.0. Building Windows, Web, and RIA Applications for the .NET 4.0 Framework - Helion
ISBN: 978-14-493-9972-6
stron: 858, Format: ebook
Data wydania: 2010-07-30
Księgarnia: Helion
Cena książki: 169,14 zł (poprzednio: 198,99 zł)
Oszczędzasz: 15% (-29,85 zł)
With its support for dynamic programming, C# 4.0 continues to evolve as a versatile language on its own. But when C# is used with .NET Framework 4, the combination is incredibly powerful. This bestselling tutorial shows you how to build web, desktop, and rich Internet applications using C# 4.0 with .NET's database capabilities, UI framework (WPF), extensive communication services (WCF), and more.
In this sixth edition, .NET experts Ian Griffiths, Matthew Adams, and Jesse Liberty cover the latest enhancements to C#, as well as the fundamentals of both the language and framework. You'll learn concurrent programming with C# 4.0, and how to use .NET tools such as the Entity Framework for easier data access, and the Silverlight platform for browser-based RIA development.
- Learn C# fundamentals, such as variables, flow control, loops, and methods
- Build complex programs with object-oriented and functional programming techniques
- Process large collections of data with the native query features in LINQ
- Communicate across networks with Windows Communication Foundation (WCF)
- Learn the advantages of C# 4.0's dynamic language features
- Build interactive Windows applications with Windows Presentation Foundation (WPF)
- Create rich web applications with Silverlight and ASP.NET
Osoby które kupowały "Programming C# 4.0. Building Windows, Web, and RIA Applications for the .NET 4.0 Framework", wybierały także:
- Gray Hat C#. Język C# w kontroli i łamaniu zabezpieczeń 57,74 zł, (17,90 zł -69%)
- ASP.NET Core 6. Kurs video. Rozwijaj aplikacje webowe z Entity Framework Core 179,00 zł, (71,60 zł -60%)
- Testowanie automatyczne w .NET. Kurs video. Zastosowania frameworka nUnit 169,00 zł, (76,05 zł -55%)
- Programowanie asynchroniczne i równoległe w C#. Kurs video. Poziom podstawowy 69,00 zł, (31,05 zł -55%)
- Technologia LINQ. Kurs video. Warsztat pracy z danymi z różnych źródeł 59,00 zł, (26,55 zł -55%)
Spis treści
Programming C# 4.0. Building Windows, Web, and RIA Applications for the .NET 4.0 Framework eBook -- spis treści
- Programming C# 4.0
- SPECIAL OFFER: Upgrade this ebook with OReilly
- A Note Regarding Supplemental Files
- 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
- How This Book Is Organized
- 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
- 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
- Variable Types
- Expressions and Statements
- Assignment Statements
- Increment and Decrement Operators
- Flow Control with Selection Statements
- if Statements
- if...else
- switch and case Statements
- if Statements
- Iteration Statements
- foreach Statements
- for Statements
- while and do Statements
- Breaking Out of a Loop
- Methods
- Summary
- 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
- Divide and Conquer
- 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
- 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
- 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
- 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
- Construction and Initialization
- List<T>
- Custom Indexers
- Immutability and List<T>
- Finding and Sorting
- Custom Indexers
- Collections and Polymorphism
- Creating Your Own IEnumerable<T>
- Lazy collections
- Creating Your Own IEnumerable<T>
- Summary
- Arrays
- 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
- Query Expressions
- 9. Collection Classes
- Dictionaries
- Common Dictionary Uses
- Looking up values
- Caching
- Dynamic properties
- Sparse arrays
- IDictionary<TKey, TValue>
- Dictionaries and LINQ
- Common Dictionary Uses
- HashSet and SortedSet
- Queues
- Linked Lists
- Stacks
- Summary
- Dictionaries
- 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
- Standard Numeric Format Strings
- 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
- 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 Arent Files
- An Adapting Stream: CryptoStream
- In Memory Alone: The MemoryStream
- Representing Binary As Text with Base64 Encoding
- Summary
- 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
- XML Basics (A Quick Review)
- 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
- WebClient
- Sockets
- IP, IPv6, and TCP
- Connecting to Services with the Socket Class
- Implementing Services with the Socket Class
- Other Networking Features
- Summary
- Choosing a Networking Technology
- 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
- Classic ADO.NET
- 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
- The .NET Data Access Landscape
- 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
- .NET Components: Assemblies
- 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 were 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
- Monitor
- 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
- Tasks
- Data Parallelism
- Parallel For and ForEach
- PLINQ: Parallel LINQ
- Summary
- Threads
- 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
- Types of Attributes
- Reflection
- Inspecting Metadata
- Type Discovery
- Reflecting on a Specific Type
- Finding all type members
- Finding type methods
- Late Binding
- Summary
- Attributes
- 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
- Object Types and dynamic
- dynamic in Noninterop Scenarios?
- Summary
- Static Versus Dynamic
- 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
- Importing ActiveX Controls
- 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
- Layout Panels
- Control Templates
- Styles
- The Visual State Manager
- Data Binding
- Data Templates
- Summary
- Xaml and Code Behind
- 21. Programming ASP.NET Applications
- Web Forms Fundamentals
- Web Forms Events
- Postback versus nonpostback events
- View state
- Web Forms Life Cycle
- Web Forms Events
- Creating a Web Application
- Code-Behind Files
- Adding Controls
- Server Controls
- Data Binding
- Examining the Code
- Adding Controls and Events
- Summary
- Web Forms Fundamentals
- 22. Windows Forms
- Creating the Application
- Adding a Binding Source
- Controls
- Docking and Anchoring
- Data Binding
- Event Handling
- Summary
- Creating the Application
- Index
- About the Authors
- Colophon
- SPECIAL OFFER: Upgrade this ebook with OReilly