售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Title Page
Copyright
C# 7 and .NET: Designing Modern Cross-platform Applications
About Packt
Why Subscribe?
Packt.com
Contributors
About the Authors
About the Reviewers
Packt Is Searching for Authors Like You
Preface
Who This Book Is For
What This Book Covers
To Get the Most out of This Book
Download the Example Code Files
Download the color images
Conventions Used
Get in Touch
Reviews
Controlling the Flow and Converting Types
Selection statements
Using Visual Studio 2017
Using Visual Studio Code on macOS, Linux, or Windows
The if statement
The code
Pattern matching with the if statement
The switch statement
The code
Pattern matching with the switch statement
Iteration statements
The while statement
The do statement
The for statement
The foreach statement
Casting and converting between types
Casting from numbers to numbers
Casting numbers implicitly
Casting numbers explicitly
Using the convert type
Rounding numbers
Converting from any type to a string
Converting from a binary object to a string
Parsing from strings to numbers or dates and times
Handling exceptions when converting types
The try statement
Catching all exceptions
Catching specific exceptions
Checking for overflow
The checked statement
The unchecked statement
Looking for help
Microsoft Docs and MSDN
Go to definition
Stack Overflow
Subscribing to blogs
Design patterns
Singleton pattern
Summary
Writing, Debugging, and Testing Functions
Writing functions
Writing a times table function
Writing a function that returns a value
Writing mathematical functions
Formatting numbers for output
Calculating factorials with recursion
Debugging an application during development
Creating an application with a deliberate bug
Setting a breakpoint
The debugging toolbar
Debugging windows
Stepping through code
Customizing breakpoints
Logging during development and runtime
Instrumenting with Debug and Trace
Writing to the default trace listener
Configuring trace listeners
Switching trace levels
Unit testing functions
Creating a class library that needs testing with Visual Studio 2017
Creating a unit test project with Visual Studio 2017
Creating a class library that needs testing with Visual Studio Code
Writing unit tests
Running unit tests with Visual Studio 2017
Running unit tests with Visual Studio Code
Summary
Building Your Own Types with Object-Oriented Programming
Talking about OOP
Building class libraries
Creating a class library with Visual Studio 2017
Creating a class library with Visual Studio Code
Defining a class
Instantiating a class
Referencing an assembly using Visual Studio 2017
Referencing an assembly using Visual Studio Code
Importing a namespace
Managing multiple projects with Visual Studio Code
Inheriting from System.Object
Storing data with fields
Defining fields
Understanding access modifiers
Storing a value using the enum keyword
Storing multiple values using collections
Making a field static
Making a field constant
Making a field read-only
Initializing fields with constructors
Setting fields with default literal
Writing and calling methods
Combining multiple values with tuples
Defining methods with tuples
Naming the fields of a tuple
Inferring tuple names
Deconstructing tuples
Defining and passing parameters to methods
Overloading methods
Optional parameters and named arguments
Controlling how parameters are passed
Splitting classes using partial
Controlling access with properties and indexers
Defining read-only properties
Defining settable properties
Defining indexers
Summary
Implementing Interfaces and Inheriting Classes
Setting up a class library and console application
Using Visual Studio 2017
Using Visual Studio Code
Defining the classes
Simplifying methods with operators
Implementing some functionality with a method
Implementing some functionality with an operator
Defining local functions
Raising and handling events
Calling methods using delegates
Defining events
Using Visual Studio 2017
Using Visual Studio Code
Using Visual Studio 2017 or Visual Studio Code
Implementing interfaces
Common interfaces
Comparing objects when sorting
Attempting to sort objects without a method to compare
Defining a method to compare
Defining a separate comparer
Making types more reusable with generics
Making a generic type
Making a generic method
Managing memory with reference and value types
Defining a struct type
Releasing unmanaged resources
Ensuring that dispose is called
Inheriting from classes
Extending classes
Hiding members
Overriding members
Using Visual Studio 2017
Using Visual Studio 2017 or Visual Studio Code
Preventing inheritance and overriding
Polymorphism
Casting within inheritance hierarchies
Implicit casting
Explicit casting
Handling casting exceptions
Inheriting and extending .NET types
Inheriting from an exception
Extending types when you can't inherit
Using static methods to reuse functionality
Using extension methods to reuse functionality
Summary
Understanding and Packaging .NET Standard Types
Understanding assemblies and namespaces
Base Class Libraries and CoreFX
Assemblies, NuGet packages, and platforms
Namespaces
Understanding dependent assemblies
Using Visual Studio 2017
Using Visual Studio Code
Using Visual Studio 2017 and Visual Studio Code
Relating assemblies and namespaces
Browsing assemblies with Visual Studio 2017
Using Visual Studio 2017 or Visual Studio Code
Importing a namespace
Relating C# keywords to .NET types
Sharing code cross-platform with .NET Standard 2.0 class libraries
Creating a .NET Standard 2.0 class library
Using Visual Studio 2017
Using Visual Studio Code
Understanding NuGet packages
Understanding metapackages
Understanding frameworks
Fixing dependencies
Publishing your applications for deployment
Creating a console application to publish
Publishing with Visual Studio 2017 on Windows
Publishing with Visual Studio Code on macOS
Packaging your libraries for NuGet distribution
Understanding dotnet commands
Adding a package reference
Using Visual Studio Code
Using Visual Studio 2017
Packaging a library for NuGet
Testing your package
Using Visual Studio Code
Using Visual Studio 2017
Using Visual Studio 2017 and Visual Studio Code
Porting from .NET Framework to .NET Core
Could you port?
Should you port?
Differences between .NET Framework and .NET Core
Understanding the .NET Portability Analyzer
Using non-.NET Standard libraries
Summary
Using Common .NET Standard Types
Working with numbers
Working with big integers
Working with complex numbers
Working with text
Getting the length of a string
Getting the characters of a string
Splitting a string
Getting part of a string
Checking a string for content
Other string members
Building strings efficiently
Pattern matching with regular expressions
The syntax of a regular expression
Examples of regular expressions
Working with collections
Common features of all collections
Understanding collections
Lists
Dictionaries
Stacks
Queues
Sets
Working with lists
Working with dictionaries
Sorting collections
Using specialized collections
Using immutable collections
Working with network resources
Working with URIs, DNS, and IP addresses
Pinging a server
Working with types and attributes
Versioning of assemblies
Reading assembly metadata
Creating custom attributes
Doing more with reflection
Internationalizing your code
Globalizing an application
Summary
Working with Files, Streams, and Serialization
Managing the filesystem
Handling cross-platform environments and filesystems
Using Windows 10
Using macOS
Managing drives
Managing directories
Managing files
Managing paths
Getting file information
Controlling files
Reading and writing with streams
Writing to text and XML streams
Writing to text streams
Writing to XML streams
Disposing of file resources
Implementing disposal with try statement
Simplifying disposal with the using statement
Compressing streams
Encoding text
Encoding strings as byte arrays
Encoding and decoding text in files
Serializing object graphs
Serializing with XML
Deserializing with XML
Customizing the XML
Serializing with JSON
Serializing with other formats
Summary
Improving Performance and Scalability Using Multitasking
Monitoring performance and resource usage
Evaluating the efficiency of types
Monitoring performance and memory use
Using Visual Studio 2017
Using Visual Studio Code
Creating the Recorder class
Measuring the efficiency of processing strings
Understanding processes, threads, and tasks
Running tasks asynchronously
Running multiple actions synchronously
Running multiple actions asynchronously using tasks
Waiting for tasks
Continuing with another task
Nested and child tasks
Synchronizing access to shared resources
Accessing a resource from multiple threads
Applying a mutually exclusive lock to a resource
Understanding the lock statement
Making operations atomic
Applying other types of synchronization
Understanding async and await
Improving responsiveness for console apps
Improving responsiveness for GUI apps
Improving scalability for web applications and web services
Common types that support multitasking
Await in catch blocks
Summary
Building Web Sites Using ASP.NET Core Razor Pages
Understanding web development
Understanding HTTP
Client-side web development
Understanding ASP.NET Core
Classic ASP.NET versus modern ASP.NET Core
Creating an ASP.NET Core project with Visual Studio 2017
Creating an ASP.NET Core project with Visual Studio Code
Reviewing the ASP.NET Core Empty project template
Testing the empty website
Enabling static files
Enabling default files
Exploring Razor Pages
Enabling Razor Pages
Defining a Razor Page
Using shared layouts with Razor Pages
Setting a shared layout
Defining a shared layout
Using code-behind files with Razor Pages
Using Entity Framework Core with ASP.NET Core
Creating Entity models for Northwind
Creating a class library for the Northwind entity classes
Defining the entity classes
Creating a class library for Northwind database context
Using Visual Studio 2017
Using Visual Studio Code
Defining the database context class
Configure Entity Framework Core as a service
Manipulating data
Summary
Building Web Sites Using ASP.NET Core MVC
Setting up an ASP.NET Core MVC website
Creating an ASP.NET Core MVC website
Using Visual Studio 2017
Using Visual Studio Code
Reviewing the ASP.NET Core MVC project template
Performing database migrations
Using Visual Studio 2017
Using Visual Studio Code
Testing the ASP.NET MVC website
Reviewing authentication with ASP.NET Identity
Understanding an ASP.NET Core MVC website
ASP.NET Core startup
Understanding the default route
Understanding ASP.NET Core MVC controllers
Understanding ASP.NET Core MVC models
Configuring an EF Core entity data model
Creating view models for requests
Fetch the model in the controller
Understanding ASP.NET Core MVC views
Rendering the Home controller's views
Sharing layouts between views
Defining custom styles
Defining a typed view
Passing parameters using a route value
Passing parameters using a query string
Summary
Building Web Services and Applications Using ASP.NET Core
Building web services using ASP.NET Core Web API
Understanding ASP.NET Core controllers
Creating an ASP.NET Core Web API project
Using Visual Studio 2017
Using Visual Studio Code
Using Visual Studio 2017 and Visual Studio Code
Creating a web service for the Northwind database
Using Visual Studio 2017
Using Visual Studio Code
Using Visual Studio 2017 and Visual Studio Code
Creating data repositories for entities
Configuring and registering the customers repository
Creating the Web API controller
Documenting and testing web services using Swagger
Testing GET requests with any browser
Testing POST, PUT, and DELETE requests with Swagger
Installing a Swagger package
Using Visual Studio 2017
Using Visual Studio Code
Using Visual Studio 2017 and Visual Studio Code
Testing GET requests with Swagger UI
Testing POST requests with Swagger UI
Building SPAs using Angular
Understanding the Angular project template
Using Visual Studio 2017
Using Visual Studio Code
Using Visual Studio 2017 and Visual Studio Code
Calling NorthwindService
Using Visual Studio 2017
Using Visual Studio Code
Using Visual Studio 2017 and Visual Studio Code
Modifying the home component to call NorthwindService
Testing the Angular component calling the service
Using Visual Studio 2017
Using Visual Studio Code
Using Visual Studio 2017 and Visual Studio Code
Using other project templates
Installing additional template packs
Summary
Building Windows Apps Using XAML and Fluent Design
Understanding the modern Windows platform
Understanding Universal Windows Platform
Understanding Fluent Design System
Filling user interface elements with acrylic brushes
Connecting user interface elements with animations
Parallax views and Reveal lighting
Understanding XAML Standard 1.0
Simplifying code using XAML
Choosing common controls
Creating a modern Windows app
Enabling developer mode
Creating a UWP project
Exploring common controls and acrylic brushes
Exploring Reveal
Installing more controls
Using resources and templates
Sharing resources
Replacing a control template
Data binding
Binding to elements
Binding to data sources
Modifying the NorthwindService
Creating the Northwind app
Building apps using Windows Template Studio
Installing Windows Template Studio
Selecting project types, frameworks, pages, and features
Retargeting the project
Customizing some views
Testing the app's functionality
Summary
Building Mobile Apps Using XAML and Xamarin.Forms
Understanding Xamarin and Xamarin.Forms
How Xamarin.Forms extends Xamarin
Mobile first, cloud first
Building mobile apps using Xamarin.Forms
Adding Android SDKs
Creating a Xamarin.Forms solution
Creating a model
Creating an interface for dialing phone numbers
Implement the phone dialer for iOS
Implement the phone dialer for Android
Creating views for the customers list and customer details
Creating the view for the list of customers
Creating the view for the customer details
Testing the mobile app with iOS
Adding NuGet packages for calling a REST service
Getting customers from the service
Summary
Understanding .NET Core Internals and Measuring Performance
.NET Core internals
CoreFX
CoreCLR
Understanding MSIL, CLI, CTS, and CLS
How the CLR works
From compilation to execution – Under the hood
Garbage collection
Generations in GC
.NET Native and JIT compilation
Utilizing multiple cores of the CPU for high performance
How releasing builds increases performance
Benchmarking .NET Core 2.0 applications
Exploring BenchmarkDotNet
How it works
Setting parameters
Memory diagnostics using BenchmarkDotnet
Adding configurations
Summary
Data Structures and Writing Optimized Code in C#
What are data structures?
Understanding the use of Big O notation to measure the performance and complexity of an algorithm
Logarithms
Choosing the right data structure for performance optimization
Arrays
Lists
Stacks
Queue
Linked lists
Singly linked lists
Doubly linked lists
Circular linked lists
Dictionaries, hashtables, and hashsets
Generic lists
Best practices in writing optimized code in C#
Boxing and unboxing overhead
String concatenation
Exception handling
For and foreach
Delegates
Summary
Designing Guidelines for .NET Core Application Performance
Coding principles
Naming convention
Code comments
One class per file
One logic per method
Design principles
KISS (Keep It Simple, Stupid)
YAGNI (You Aren't Gonna Need It)
DRY (Don't Repeat Yourself)
Separation of Concerns (SoC)
SOLID principles
Single Responsibility Principle
Open Closed principle
Parameters
Inheritance
Composition
Liskov principle
The Interface Segregation principle
The Dependency Inversion principle
Caching
Data structures
Communication
Using lighter interfaces
Minimizing message size
Queuing communication
Resource management
Avoiding improper use of threads
Disposing objects in a timely fashion
Acquiring resources when they are required
Concurrency
Summary
Memory Management Techniques in .NET Core
Memory allocation process overview
Analysing CLR internals through the SOS debugger in .NET Core
Memory fragmentation
Avoiding finalizers
Best practices for disposing of objects in .NET Core
Introduction to the IDisposable interface
What are unmanaged resources?
Using IDisposable
When to implement the IDisposable interface
Finalizer and Dispose
Summary
Microservices Architecture
Microservices architecture
Benefits of microservices architecture
Standard practice when developing microservices
Types of microservices
Stateless microservices
Stateful microservices
DDD
Data manipulation with microservices
Wrapping microservices behind an API gateway
Denormalizing data into a flat schema for read/query purposes
Consistency across business scenarios
Communication with microservices
Database architecture in microservices
Tables per service
Database per service
Challenges in segregating tables or databases per service
What is API composition?
CQRS
Developing microservices architecture with .NET Core
Creating a sample app in .NET Core using microservices architecture
Solution structure
Logical architecture
Developing a Core infrastructure project
Creating the BaseEntity class
The UnitOfWork pattern
Creating a repository interface
Logging
Creating the APIComponents infrastructure project
Developing an identity service for user authorization
OpenIddict connect flows
Creating the identity service project
Implementing the vendor service
Creating a vendor domain
Creating the vendor infrastructure
Creating the vendor service
Implementing the mediator pattern in the vendor service
Deploying microservices on Docker containers
What is Docker?
Using Docker with .NET Core
Running Docker images
Summary
Other Books You May Enjoy
Leave a Review - Let Other Readers Know What You Think
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜