C# 7与.NET Core:构建现代跨平台应用

需积分: 9 6 下载量 150 浏览量 更新于2024-07-17 1 收藏 54.41MB PDF 举报
C# 7和.NET:设计现代跨平台应用 C# 7是一个面向现代编程的里程碑,它在Microsoft的.NET框架中占据了核心地位。作为一款广泛使用的编程语言,C#以其简洁易学、灵活性和对现代设计模式的支持而闻名。它不仅适用于Windows开发,也已扩展到跨平台环境,尤其是通过.NET Core的开源革命,使得C#能在Mac OS和Linux上运行,为开发者提供了更大的创作自由度。 在C# 7版本中,语言引入了一系列新特性,如异步流(Async Streams)、可空引用类型(Null-Conditional Operators)、范围基础的foreach循环(Range-Based For Loops)以及更强大的字符串处理功能等,这些改进旨在提高代码的可读性和性能。例如,async/await语法让异步编程变得更加直观,同时避免了回调地狱的问题。 .NET Core则带来了轻量级、模块化和可移植性的革新。它是.NET框架的一个精简版本,专注于微服务架构和云部署,允许开发者构建高效且跨平台的应用程序。开放源代码的特性促进了社区的活跃参与和生态系统的发展,同时也降低了开发者的部署成本,因为应用程序可以在多个操作系统上运行,无需为每个平台单独编译。 本书《C# 7 and .NET: Designing Modern Cross-platform Applications》由Mark J. Price和Ovais Mehboob Ahmed Khan共同撰写,旨在帮助读者掌握利用最新C#语言特性和.NET Core构建现代、跨平台应用的技能。作者们深入探讨了如何利用C# 7的新功能来优化代码结构,以及如何利用.NET Core的优势实现高效的跨平台部署和维护。 书中内容涵盖了从基础概念到高级实践的全方位指导,包括但不限于UI设计、Web开发、移动应用开发、微服务架构和云集成等方面。无论是初学者还是经验丰富的开发人员,都能从中找到提升技能和适应新时代技术发展所需的知识。 学习并掌握C# 7和.NET Core对于构建高效、现代且跨平台的应用至关重要。随着技术的不断演进,这个组合将继续引领软件开发的潮流,为开发者创造无限可能。阅读这本书将有助于你在IT行业中保持竞争力,并充分利用最新的工具和技术。
2017-10-14 上传
2017年第二版, PDF格式 What this book covers Chapter 1, Hello, C#! Welcome, .NET Core!, is about setting up your development environment and using various tools to create the simplest application possible with C#. You will learn how to write and compile code using Visual Studio 2017 on Windows, or Visual Studio Code on macOS, Linux, or Windows. You will learn about the different .NET technologies: .NET Framework, .NET Core, .NET Standard, and .NET Native. Chapter 2, Speaking C#, is about the C# language---the grammar and vocabulary that you will use every day to write the source code for your applications. In particular, you will learn how to declare and work with variables of different types. Chapter 3, Controlling Flow, Converting Types, and Handling Exceptions, is about writing code that makes decisions, repeats a block of statements, converts between types, and handles errors. You will also learn the best places to look for help. Chapter 4, Using .NET Standard Types, is about commonly used .NET Core types that are part of .NET Standard and how they are related to C#. You will learn about the .NET Standard class library assemblies and the NuGet packages of types that allow your applications to connect existing components to perform common practical tasks, such as manipulating text, storing items in collections, and implementing internationalization. Chapter 5, Debugging, Monitoring, and Testing, is about debugging tools, monitoring, diagnosing problems, and testing your code to remove bugs and ensuring high performance, stability, and reliability. Chapter 6, Building Your Own Types with Object-Oriented Programming, is about all the different categories of members that a type can have, including fields to store data and methods to perform actions. You will use OOP concepts, such as aggregation and encapsulation. You will learn about the C# 7 language features such as tuple syntax support and out variables. Chapter 7, Implementing Interfaces and Inheriting Classes, is about deriving new types from existing ones using object-oriented programming (OOP). You will learn how to define operators and C# 7 local functions, delegates and events, how to implement interfaces about base and derived classes, how to override a type member, how to use polymorphism, how to create extension methods, and how to cast between classes in an inheritance hierarchy. Chapter 8, Working with Databases Using Entity Framework Core, is about reading and writing to databases, such as Microsoft SQL Server and SQLite, using the object-relational mapping technology known as the Entity Framework Core. Chapter 9, Querying and Manipulating Data with LINQ, is about Language INtegrated Query (LINQ)---language extensions that add the ability to work with sequences of items and filter, sort, and project them into different outputs. Chapter 10, Working with Files, Streams, and Serialization, is about managing the filesystem, reading and writing to files and streams, text encoding, and serialization. Chapter 11, Protecting Your Data, is about protecting your data from being viewed by malicious users using encryption and from being manipulated or corrupted using hashing and signing. Chapter 12, Improving Performance and Scalability with Multitasking, is about allowing multiple actions to occur at the same time to improve performance, scalability, and user productivity. Chapter 13, Building Universal Windows Platform Apps Using XAML, is about learning the basics of XAML that can be used to define the user interface for a graphical app for the Universal Windows Platform (UWP). This app can then run on Windows 10, Windows 10 Mobile, Xbox One, and even HoloLens. Chapter 14, Building Web Applications Using ASP.NET Core MVC, is about learning the basics of building web applications with a modern HTTP architecture on the server side using ASP.NET Core MVC. You will learn about the startup configuration, authentication, routes, models, views, and controllers that make up ASP.NET Core MVC. Chapter