`

the .NET Framework 4 新特性

    博客分类:
  • .NET
阅读更多

(附件里有中英文对照-这是从VS2010上Copy下来的)

What's New in the .NET Framework 4
.NET Framework 4 其他版本  Visual Studio 2008
Visual Studio 2005

This topic contains information about key features and improvements in the .NET Framework version 4. This topic does not provide comprehensive information about all new features and is subject to change.

The .NET Framework 4 introduces an improved security model. For more information, see Security Changes in the .NET Framework 4.

Other new features and improvements in the .NET Framework 4 are described in the following sections:

Application Compatibility and Deployment

Core New Features and Improvements

Managed Extensibility Framework

Parallel Computing

Networking

Web

Client

Data

Windows Communication Foundation

Windows Workflow Foundation

See New Types and Members in the .NET Framework 4 for lists of new namespaces, new types, and new members added to existing types.

Visual Studio 2010 Service Pack 1 (SP1) includes an update to the .NET Framework 4.

Application Compatibility and Deployment
--------------------------------------------------------------------------------

The .NET Framework 4 is highly compatible with applications that are built with earlier .NET Framework versions, except for some changes that were made to improve security, standards compliance, correctness, reliability, and performance.

The .NET Framework 4 does not automatically use its version of the common language runtime to run applications that are built with earlier versions of the .NET Framework. To run older applications with .NET Framework 4, you must compile your application with the target .NET Framework version specified in the properties for your project in Visual Studio, or you can specify the supported runtime with the <supportedRuntime> Element in an application configuration file.

If your application or component does not work after .NET Framework 4 is installed, please submit a bug on the Microsoft Connect Web site. You can test compatibility as described in the .NET Framework 4 Application Compatibility topic and learn about new features by using the Visual Studio 2010 and .NET Framework 4 Walkthroughs.

For guidance about migrating to the .NET Framework 4, see Migration Guide to the .NET Framework 4 and Version Compatibility in the .NET Framework

The following sections describe deployment improvements.

Client Profile
The .NET Framework 4 Client Profile supports more platforms than in previous versions and provides a fast deployment experience for your applications. Several new project templates now target the Client Profile by default. For more information, see .NET Framework Client Profile.

In-Process Side-by-Side Execution
This feature enables an application to load and start multiple versions of the .NET Framework in the same process. For example, you can run applications that load add-ins (or components) that are based on the .NET Framework 2.0 SP1 and add-ins that are based on the .NET Framework 4 in the same process. Older components continue to use the older .NET Framework version, and new components use the new .NET Framework version. For more information, see In-Process Side-by-Side Execution.

Portable Class Library
When you install Visual Studio 2010 Service Pack 1 (SP1) and the Portable Library Tools, you can create portable class libraries that run on a variety of .NET Framework platforms without recompiling. For more information, see Portable Class Library.

Back to top

Core New Features and Improvements
--------------------------------------------------------------------------------

The following sections describe new features and improvements provided by the common language runtime and the base class libraries.

Diagnostics and Performance
Earlier versions of the .NET Framework provided no way to determine whether a particular application domain was affecting other application domains, because the operating system APIs and tools, such as the Windows Task Manager, were precise only to the process level. Starting with the .NET Framework 4, you can get processor usage and memory usage estimates per application domain.

You can monitor CPU and memory usage of individual application domains. Application domain resource monitoring is available through the managed and native hosting APIs and event tracing for Windows (ETW). When this feature has been enabled, it collects statistics on all application domains in the process for the life of the process. See the new AppDomain.MonitoringIsEnabled property.

You can now access the ETW events for diagnostic purposes to improve performance. For more information, see CLR ETW Events and Controlling .NET Framework Logging. Also see Performance Counters and In-Process Side-By-Side Applications.

The System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute attribute enables managed code to handle exceptions that indicate corrupted process state.

Globalization
The .NET Framework 4 provides new neutral and specific cultures, updated property values, improvements in string handling, and other improvements. For more information, see What's New in Globalization and Localization.

Garbage Collection
The .NET Framework 4 provides background garbage collection. This feature replaces concurrent garbage collection in previous versions and provides better performance. For more information, see Fundamentals of Garbage Collection.

Code Contracts
Code contracts let you specify contractual information that is not represented by a method's or type's signature alone. The new System.Diagnostics.Contracts namespace contains classes that provide a language-neutral way to express coding assumptions in the form of preconditions, postconditions, and object invariants. The contracts improve testing with run-time checking, enable static contract verification, and support documentation generation. For more information, see Code Contracts.

Design-Time-Only Interop Assemblies
You no longer have to ship primary interop assemblies (PIAs) to deploy applications that interoperate with COM objects. In the .NET Framework 4, compilers can embed type information from interop assemblies, selecting only the types that an application (for example, an add-in) actually uses. Type safety is ensured by the common language runtime. See Using COM Types in Managed Code and Walkthrough: Embedding Type Information from Microsoft Office Assemblies (C# and Visual Basic).

Dynamic Language Runtime
The dynamic language runtime (DLR) is a new runtime environment that adds a set of services for dynamic languages to the CLR. The DLR makes it easier to develop dynamic languages to run on the .NET Framework and to add dynamic features to statically typed languages. To support the DLR, the new System.Dynamic namespace is added to the .NET Framework.

The expression trees are extended with new types that represent control flow, for example, System.Linq.Expressions.LoopExpression and System.Linq.Expressions.TryExpression. These new types are used by the dynamic language runtime (DLR) and not used by LINQ.

In addition, several new classes that support the .NET Framework infrastructure are added to the System.Runtime.CompilerServices namespace. For more information, see Dynamic Language Runtime Overview.

Covariance and Contravariance
Several generic interfaces and delegates now support covariance and contravariance. For more information, see Covariance and Contravariance in Generics.

BigInteger and Complex Numbers
The new System.Numerics.BigInteger structure is an arbitrary-precision integer data type that supports all the standard integer operations, including bit manipulation. It can be used from any .NET Framework language. In addition, some of the new .NET Framework languages (such as F# and IronPython) have built-in support for this structure.

The new System.Numerics.Complex structure represents a complex number that supports arithmetic and trigonometric operations with complex numbers.

Tuples
The .NET Framework 4 provides the System.Tuple class for creating tuple objects that contain structured data. It also provides generic tuple classes to support tuples that have from one to eight components (that is, singletons through octuples). To support tuple objects that have nine or more components, there is a generic tuple class with seven type parameters and an eighth parameter of any tuple type.

File System Enumeration Improvements
New file enumeration methods improve the performance of applications that access large file directories or that iterate through the lines in large files. For more information, see How to: Enumerate Directories and Files.

Memory-Mapped Files
The .NET Framework now supports memory-mapped files. You can use memory-mapped files to edit very large files and to create shared memory for interprocess communication.

64-Bit Operating Systems and Processes
You can identify 64-bit operating systems and processes with the Environment.Is64BitOperatingSystem and Environment.Is64BitProcess properties.

You can specify a 32-bit or 64-bit view of the registry with the Microsoft.Win32.RegistryView enumeration when you open base keys.

Other New Features
The following list describes additional new capabilities, improvements, and conveniences. Several of these are based on customer suggestions.

To support culture-sensitive formatting, the System.TimeSpan structure includes new overloads of the ToString, Parse, and TryParse methods, as well as new ParseExact and TryParseExact methods.

The new String.IsNullOrWhiteSpace method indicates whether a string is null, empty, or consists only of white-space characters. New overloads have been added to the String.Concat and String.Join methods that concatenate members of System.Collections.Generic.IEnumerable(Of T) collections.

The String.Concat method lets you concatenate each element in an enumerable collection without first converting the elements to strings.

Two new convenience methods are available: StringBuilder.Clear and Stopwatch.Restart.

The new Enum.HasFlag method determines whether one or more bit fields or flags are set in an enumeration value. The Enum.TryParse method returns a Boolean value that indicates whether a string or integer value could be successfully parsed.

The System.Environment.SpecialFolder enumeration contains several new folders.

You can now easily copy one stream into another with the CopyTo method in classes that inherit from the System.IO.Stream class.

New Path.Combine method overloads enable you to combine file paths.

The new System.IObservable(Of T) and System.IObserver(Of T) interfaces provide a generalized mechanism for push-based notifications.

The System.IntPtr and System.UIntPtr classes now include support for the addition and subtraction operators.

You can now enable lazy initialization for any custom type by wrapping the type inside a System.Lazy(Of T) class.

The new System.Collections.Generic.SortedSet(Of T) class provides a self-balancing tree that maintains data in sorted order after insertions, deletions, and searches. This class implements the new System.Collections.Generic.ISet(Of T) interface.

The compression algorithms for the System.IO.Compression.DeflateStream and System.IO.Compression.GZipStream classes have improved so that data that is already compressed is no longer inflated. Also, the 4-gigabyte size restriction for compressing streams has been removed.

The new Monitor.Enter(Object, Boolean) method overload takes a Boolean reference and atomically sets it to true only if the monitor is successfully entered.

You can use the Thread.Yield method to have the calling thread yield execution to another thread that is ready to run on the current processor.

The System.Guid structure now contains the TryParse and TryParseExact methods.

The new Microsoft.Win32.RegistryOptions enumeration lets you specify a volatile registry key that does not persist after the computer restarts.

Registry keys are no longer restricted to a maximum length of 255 characters.

Back to top

Managed Extensibility Framework
--------------------------------------------------------------------------------

The Managed Extensibility Framework (MEF) is a new library in the .NET Framework 4 that helps you build extensible and composable applications. MEF enables you to specify points where an application can be extended, to expose services to offer to other extensible applications and to create parts for consumption by extensible applications. It also enables easy discoverability of available parts based on metadata, without the need to load the assemblies for the parts. For more information, see Managed Extensibility Framework Overview and Managed Extensibility Framework. For a list of the MEF types, see the System.ComponentModel.Composition namespace.

Back to top

Parallel Computing
--------------------------------------------------------------------------------

The .NET Framework 4 introduces a new programming model for writing multithreaded and asynchronous code that greatly simplifies the work of application and library developers. The new model enables developers to write efficient, fine-grained, and scalable parallel code in a natural idiom without having to work directly with threads or the thread pool. The new System.Threading.Tasks namespace and other related types support this new model. Parallel LINQ (PLINQ), which is a parallel implementation of LINQ to Objects, enables similar functionality through declarative syntax. For more information, see Parallel Programming in the .NET Framework.

Back to top

Networking
--------------------------------------------------------------------------------

Networking improvements include the following:

Security improvements for Windows authentication in several classes, including System.Net.HttpWebRequest, System.Net.HttpListener, System.Net.Mail.SmtpClient, System.Net.Security.SslStream, and System.Net.Security.NegotiateStream. Extended protection is available for applications on Windows 7 and Windows Server 2008 R2. For more information, see Integrated Windows Authentication with Extended Protection.

Support for Network Address Translation (NAT) traversal using IPv6 and Teredo. For more information, see NAT Traversal using IPv6 and Teredo.

New networking performance counters that provide information about HttpWebRequest objects. For more information, see Networking Performance Counters.

In the System.Net.HttpWebRequest class, support for using large byte range headers (64-bit ranges) with new overloads for the AddRange method. New properties on the System.Net.HttpWebRequest class allow an application to set many HTTP headers. You can use the Host property to set the Host header value in an HTTP request that is independent from the request URI.

Secure Sockets Layer (SSL) support for the System.Net.Mail.SmtpClient and related classes.

Improved support for mail headers in the System.Net.Mail.MailMessage class.

Support for a null cipher for use in encryption. You can specify the encryption policy by using the System.Net.ServicePointManager class and the EncryptionPolicy property. Constructors for the System.Net.Security.SslStream class now take a System.Net.Security.EncryptionPolicy class as a parameter.

Credentials for password-based authentication schemes such as basic, digest, NTLM, and Kerberos authentication in the System.Net.NetworkCredential class. To improve security, passwords may now be treated as System.Security.SecureString instances rather than System.String instances.

Ability to specify how a URI with percent-encoded values is converted and normalized in the System.Uri and System.Net.HttpListener classes. For more information, see the System.Net.Configuration.HttpListenerElement, System.Configuration.SchemeSettingElement, System.Configuration.SchemeSettingElementCollection, and System.Configuration.UriSection classes.

Back to top

Web
--------------------------------------------------------------------------------

ASP.NET version 4 introduces new features in the following areas:

Core services, including a new API that lets you extend caching, support for compression for session-state data, and a new application preload manager (autostart feature).

Web Forms, including more integrated support for ASP.NET routing, enhanced support for Web standards, updated browser support, new features for data controls, and new features for view state management.

Web Forms controls, including a new Chart control.

MVC, including new helper methods for views, support for partitioned MVC applications, and asynchronous controllers.

Dynamic Data, including support for existing Web applications, support for many-to-many relationships and inheritance, new field templates and attributes, and enhanced data filtering.

Microsoft Ajax, including additional support for client-based Ajax applications in the Microsoft Ajax Library.

Visual Web Developer, including improved IntelliSense for JScript, new auto-complete snippets for HTML and ASP.NET markup, and enhanced CSS compatibility.

Deployment, including new tools for automating typical deployment tasks.

Multi-targeting, including better filtering for features that are not available in the target version of the .NET Framework.

For more information about these features, see What's New in ASP.NET 4 and Visual Web Developer.

Back to top

Client
--------------------------------------------------------------------------------

Windows Presentation Foundation (WPF) version 4 contains changes and improvements in the following areas:

New controls, including Calendar, DataGrid, and DatePicker.

VisualStateManager supports changing states of controls.

Touch and Manipulation enables you to create applications that receive input from multiple touches simultaneously on Windows 7.

Graphics and animation supports layout rounding, Pixel Shader version 3.0, cached composition, and easing functions.

Text has improved text rendering and supports customizing the caret color and selection color in text boxes.

Binding is supported on the Command property of an InputBinding, dynamic objects, and the Text property.

XAML browser applications (XBAPs) support communication with the Web page and support full-trust deployment.

New types in the System.Windows.Shell namespace enable you to communicate with the Windows 7 taskbar and pass data to the Windows shell.

The WPF and Silverlight Designer in Visual Studio 2010 has various designer improvements to help create WPF or Silverlight applications.

For more information, see What's New in WPF Version 4.

Back to top

Data
--------------------------------------------------------------------------------

ADO.NET
ADO.NET provides new features for the Entity Framework, including persistence-ignorant objects, functions in LINQ queries, and customized object layer code generation. For more information, see What's New in ADO.NET.

Dynamic Data
For ASP.NET 4, Dynamic Data has been enhanced to give you even more power for quickly building data-driven Web sites. This includes the following:

Automatic validation that is based on constraints that are defined in the data model.

The ability to easily change the markup that is generated for fields in the GridView and DetailsView controls by using field templates that are part of a Dynamic Data project.

For more information, see What's New in ASP.NET 4 and Visual Web Developer.

WCF Data Services
ADO.NET Data Service has been renamed to WCF Data Services, and has the following new features

Data binding.

Counting entities in an entity set.

Server-driven paging.

Query projections.

Custom data service providers.

Streaming of binary resources.

For more information, see What's New in WCF Data Services.

Back to top

Windows Communication Foundation
--------------------------------------------------------------------------------

Windows Communication Foundation (WCF) provides the following improvements:

Configuration-based activation: Removes the requirement for having an .svc file.

System.Web.Routing integration: Gives you more control over your service's URL by allowing the use of extensionless URLs.

Multiple IIS site bindings support: Allows you to have multiple base addresses with the same protocol on the same Web site.

Routing Service: Allows you to route messages based on content.

Support for WS-Discovery: Allows you to create and search for discoverable services.

Standard endpoints: Predefined endpoints that allow you to specify only certain properties.

Workflow services: Integrates WCF and WF by providing activities to send and receive messages, the ability to correlate messages based on content, and a workflow service host.

WCF REST features:

Web HTTP caching: Allows caching of Web HTTP service responses.

Web HTTP formats support: Allows you to dynamically determine the best format for a service operation to respond in.

Web HTTP services help page: Provides an automatic help page for Web HTTP services, similar to the WCF service help page.

Web HTTP error handling: Allows Web HTTP Services to return error information in the same format as the operation.

Web HTTP cross-domain JavaScript support: Allows use of JSON Padding (JSONP).

Simplified configuration: Reduces the amount of configuration a service requires

For more information, see What's New in Windows Communication Foundation.

Back to top

Windows Workflow Foundation
--------------------------------------------------------------------------------

Windows Workflow Foundation (WF) provides improvements in the following areas:

Improved workflow activity model: The Activity class provides the base abstraction of workflow behavior.

Rich composite activity options: Workflows benefit from new flow-control activities that model traditional flow-control structures, such as Flowchart, TryCatch, and Switch(Of T).

Expanded built-in activity library: New features of the activity library include new flow-control activities, activities for manipulating member data, and activities for controlling transactions.

Explicit activity data model: New options for storing or moving data include variable and directional arguments.

Enhanced hosting, persistence, and tracking options: Hosting enhancements include more options for running workflows, explicit persistence using the Persistactivity, persisting without unloading, preventing persistence by using no-persist zones, using ambient transactions from the host, recording tracking information to the event log, and resuming pending workflows by using a Bookmark object.

Easier ability to extend the WF Designer: The new WF Designer is built on Windows Presentation Foundation (WPF) and provides an easier model to use when rehosting the WF Designer outside of Visual Studio.

For more information, see What's New in Windows Workflow Foundation.

Back to top

See Also
--------------------------------------------------------------------------------

Concepts
What's New in Visual Studio 2010
What's New in ASP.NET 4 and Visual Web Developer
What's New in WPF Version 4
What's New in ADO.NET
What's New in Visual Basic 2010
What's New in Visual C# 2010
What's New in Visual C++ 2010
What's New in Visual F# 2010
Other Resources
New Types and Members in the .NET Framework 4
What's New in Windows Communication Foundation
What's New in Windows Workflow Foundation
What's New in WCF Data Services

分享到:
评论

相关推荐

    .Net Framework 4.6.1.rar

    这一版本引入了对WCF(Windows Communication Foundation)的新特性,增强了ASP.NET MVC(Model-View-Controller)框架,同时也优化了.NET Framework与Windows操作系统的集成。这些改进使得开发者能够更高效地编写出...

    完美的.NET Framework卸载工具(支持卸载framework 1.0~4.6.1)

    这个工具的出现是因为有时标准的Windows卸载机制可能无法完全卸载.NET Framework,或者在卸载过程中遇到问题,导致安装新的版本时冲突或失败。此工具旨在解决这些问题,提供一个安全、完整的卸载过程。 在卸载.NET ...

    About the .NET Framework 3.5

    .NET Framework 3.5是微软开发的一个重要的软件开发平台,它在.NET Framework 2.0和3.0的基础上进行了扩展和增强,提供了许多新的特性和工具,以帮助开发者更高效地构建、运行各种应用程序,特别是针对Web服务和媒体...

    framework 2.0 sp2完整安装版

    4. **语言支持**:支持C#、Visual Basic .NET、F#等编程语言的最新特性,为开发者提供了更丰富的编程工具。 5. **Windows Communication Foundation (WCF)**:首次在.NET Framework 2.0中引入,为构建分布式应用...

    Introducing the Microsoft .NET Framework 3.0

    微软.NET Framework 3.0是微软推出的一个关键的开发平台,它主要针对软件开发趋势的转变,特别是服务导向型开发、差异化用户体验、业务流程建模和数字身份管理。这个框架在.NET Framework 2.0的基础上进行了扩展,为...

    使用.NET Framework扩展MFC程序

    通过托管代码,开发者可以利用.NET Framework的高级特性,如泛型、类型安全和异常处理。 集成.NET Framework到MFC程序中,通常有两种方法: 1. 使用C#或VB.NET等.NET语言创建一个DLL,然后在MFC项目中调用这个DLL...

    C# 6.0 and the .NET 4.6 Framework(7th).pdf 2016第7版pdf

    《C# 6.0 and the .NET 4.6 Framework》第七版是关于C#编程语言和.NET框架的重要参考资料,特别关注了2016年发布的新特性。这本书深入探讨了C# 6.0的语法改进以及.NET 4.6框架带来的更新,为开发者提供了全面的学习...

    PROGRAMMING THE MS .NET FRAMEWORK WITH MS VISUAL C SHARP .NET DELIVERY GUIDE (VBL)

    《编程MS .NET框架使用MS Visual C# .NET交付指南(VBL)》是一本针对C#语言在Microsoft .NET Framework环境下编程的详尽指导书籍。.NET Framework是由微软开发的一个全面的开发平台,它提供了丰富的类库和工具,...

    .NET Framework Standard Library Annotated Reference-Addison-Wesley

    7. **A First Look at ASP.NET v.2.0**(作者:Alex Homer, Dave Sussman, Rob Howard): 介绍了ASP.NET版本2.0的新特性和增强功能,适合网站开发人员。 8. **The Common Language Infrastructure Annotated ...

    2349 Programming with the Microsoft .NET Framework With Microsoft Visual C# .NET (VBL)

    12. **.NET Framework的最新版本特性**:随着.NET Framework不断更新,新的特性如async/await、泛型、匿名类型、动态类型等也需要掌握。 压缩包中的文件名称列表似乎包含书籍的辅助材料,例如2349B_SG.DOC可能是...

    VB 2005 和 the .NET 2.0 高级平台(第2版)

    《VB 2005 和 the .NET 2.0 高级平台(第2版)》这本书深入探讨了Visual Basic 2005 (VB 2005)编程语言与.NET Framework 2.0平台的高级特性,旨在帮助开发者充分利用这两个技术的优势。VB 2005是微软推出的一种面向...

    Programming the .NET Compact Framework in C#

    《Programming the .NET Compact Framework in C#》是一本专注于利用C#编程语言进行Windows Mobile开发的专业书籍。本书深入探讨了如何在嵌入式系统和移动设备上构建应用程序,特别是那些基于.NET Compact Framework...

    Pro VB 2008 and The .NET 3.5 Platform

    《Pro VB 2008 and The .NET 3.5 Platform》是一本专注于Visual Basic .NET 2008和.NET Framework 3.5平台的专业书籍,它为开发者提供了全面深入的指导,帮助他们充分利用VB .NET 3.5的新特性和功能。这本书涵盖了从...

    ScreenToGif.2.15.1需要最新的.net4.6.1环境

    《ScreenToGif 2.15.1与.NET Framework 4.6.1的紧密关系》 在当今数字化的世界中,软件开发工具和技术不断进步,以满足日益复杂的需求。ScreenToGif是一款广受欢迎的屏幕录制软件,以其小巧、易用且功能强大的特性...

    Customizing the Microsoft dot NET Framework Common Language Runtime

    .NET Framework的类型系统是其强类型特性的重要基础。书会涵盖类型继承、接口、泛型、装箱和拆箱等概念。 7. **安全性(Security)** CLR的安全模型旨在保护系统免受恶意代码的攻击。这部分内容可能包括代码访问...

    精通C# 英文版 Pro C#5.0 and the .NET Framework,6th Edition

    这本书是为中高级程序员设计的,覆盖了C#以及.NET框架的基础知识和最新特性,特别是.NET 4.5版本的新功能。 本书的主要内容包括: 1. 面向对象编程:本书将深入讲解使用C#进行面向对象编程的各种概念和实践。面向...

Global site tag (gtag.js) - Google Analytics