博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

What's New in the .NET Framework Version 2.0

Posted on 2005-11-08 22:56  舒方小院  阅读(1120)  评论(0编辑  收藏  举报

The Microsoft .NET Framework version 2.0 extends the .NET Framework version 1.1 with new features, improvements to existing features, and enhancements to the documentation. This section provides information about some key additions and modifications.

Microsoft .NET Framework 2.0版相对于1.1版,扩展了一些新特性,对原来的一些特性进行了改进,对文档也进行了增强。这部分将讨论一些关键的扩展和变化。

For more information about compatibility and for a list of the public API modifications to the class library that might affect the compatibility of your application, see Compatibility Considerations and Version Changes.

如果要获取有关兼容性方面的更多信息的话,兼容性考量和版本更换提供了一份关于类库中公开API变更的列表,这里所列出的变动有可能会对你应用程序的兼容性造成影响。

64-Bit Platform Support

The new generation of 64-bit computers enables the creation of applications that can run faster and take advantage of more memory than is available to 32-bit applications. New support for 64-bit applications enables users to build managed code libraries or easily use unmanaged code libraries on 64-bit computers. For more information, see 64-bit Applications.

64位平台支持

新一代的64位计算机使创建运行更快,可操作更大范围内存地址空间的应用变为可能。新的对64位应用程序的支持使用户可以在64位计算机上创建脱管的代码库,使用非托管代码库也同样方便。查看“64位应用”获取更多相关信息。

Access Control List Support

An access control list (ACL) is used to grant or revoke permission to access a resource on a computer. New classes have been added to the .NET Framework that allow managed code to create and modify an ACL. New members that use an ACL have been added to the I/O, registry, and threading classes.

对“访问控制表”的支持

访问控制表被用来授权或者撤销对计算机资源的访问许可。.NET Framework里引入了新的类用来使托管代码可以创建和修改访问控制表,I/O,registry和threading类中都添加了操作访问控制表的新成员。

ADO.NET

New features in ADO.NET include support for user-defined types (UDT), asynchronous database operations, XML data types, large value types, snapshot isolation, and new attributes that allow applications to support multiple active result sets (MARS) with SQL Server 2005. For more information about these and other new ADO.NET features, see What's New in ADO.NET.

ADO.NET

ADO.NET中新的的特性包括了对用户自定义类型的支持,异步数据库操作,XML数据类型,大值类型,快照隔离,和其他一些新的属性,这些特性使应用程序可以支持SQL Server 2005的多活动结果集。有关ADO.NET的其他新特性,请查看What's New in ADO.NET部分。

ASP.NET

The Microsoft .NET Framework 2.0 includes significant enhancements to all areas of ASP.NET. For Web page development, new controls make it easier to add commonly used functionality to dynamic Web pages. New data controls make it possible to display and edit data on an ASP.NET Web page without writing code. An improved code-behind model makes developing ASP.NET pages easier and more robust. Caching features provide several new ways to cache pages, including the ability to build cache dependency on tables in a SQL Server database.

You can now customize Web sites and pages in a variety of ways. Profile properties enable ASP.NET to track property values for individual users automatically. Using Web Parts, you can create pages that users can customize in the browser. You can add navigation menus using simple controls.

Improvements to Web site features allow you to create professional Web sites faster and more easily. Master pages allow you to create a consistent layout for all the pages in a site, and themes allow you to define a consistent look for controls and static text. To help protect your sites, you can precompile a Web site to produce executable code from source files (both code files and the markup in .aspx pages). You can then deploy the resulting output, which does not include any source information, to a production server. Enhancements to ASP.NET also include new tools and classes to make Web site management easier for Web site developers, server administrators, and hosters.

ASP.NET accommodates a wide variety of browsers and devices. By default, controls render output that is compatible with XHTML 1.1 standards. You can use device filtering to specify different property values on the same control for different browsers.

For a more complete list of new features in ASP.NET, see What's New in ASP.NET.

ASP.NET

Microsoft .NET Framework 2.0包含了对ASP.NET所有领域的重大增强。对于Web开发来说,新的控件把给动态Web页面添加常用的功能性的东西变得更加容易。新的数据控件使得实现无代码在ASP.NET页面上展现和编辑数据成为可能。一个改进了的Code-behind模型使得开发ASP.NET应用变得更简单,开发出的ASP.NET应用也更健壮。Caching特性提供了缓存页面的几种新的途径,包括创建与SQL Server数据库中表相对应的缓存的能力。

现在你可以用多种方式来自定义网站和页面。profile属性使ASP.NET具有了自动追踪单个用户的属性值的能力。通过使用Web Part,你可以创建允许用户在浏览器中进行自定义的的页面。你可以使用简单的空间来创建导航菜单。(自己注:在SharePoint里面好像就已经有这方面功能了)

对Web网站特性的改进让你可以更快更容易创建地创建专业的Web站点。母版页让你可以在一个网站中创建一个一致的布局,主题让你可以为控件和静态文本定义一个统一的外观。你可以对网站源文件(代码文件以及在.aspx文件中的内嵌代码)进行预编译来得到一段可执行的代码(自己注:应该就是得到一组DLL文件),这有助于保护你的网站。你可以在最终的产品服务器上部署编译得到的代码,而其中并不包含任何源信息。对ASP.NET的增强当然页包括用于让网站开发人员,管理员以及客户管理网站更容易的新工具和新类。

ASP.NET适用于广泛的浏览器和设备。默认情况下,控件的render输出兼容XHTML 1.1标准。对于同样的控件,你可以使用设备筛选属性,通过指定不同的属性值来使控件适应不同的浏览器。

要获得更全面的关于ASP.NET新特性的了表,请参看What's New in ASP.NET

Authenticated Streams

Applications can use the new NegotiateStream and SslStream classes for authentication and to help secure information transmitted between a client and a server. These authenticated stream classes support mutual authentication, data encryption, and data signing. The NegotiateStream class uses the Negotiate security protocol for authentication. The SslStream class uses the Secure Socket Layer (SSL) security protocol for authentication.

COM Interop Services Enhancements

Four major enhancements have been made to the classes and tools that support interoperability with COM:

  • The operating system maintains a limited number of handles, which are used to reference critical operating system resources. The new SafeHandle and CriticalHandle classes, and their specialized derived classes, provide safe and reliable means of manipulating operating system handles.

  • Marshaling improvements make interoperating with native code easier. Two enhancements to the interop marshaler satisfy the two most common user requests: the ability to wrap native function pointers into delegates and the ability to marshal fixed-size arrays of structures inside structures.

  • The performance of calls between applications in different application domains has been made much faster for common call types.

  • New switches on the Type Library Importer (Tlbimp.exe) and Type Library Exporter (Tlbexp.exe) eliminate dependency on the registry to resolve type library references. This enhancement is important for creating robust build environments.

Console Class Additions

New members of the Console class enable applications to manipulate the dimensions of the console window and screen buffer; to move a rectangular area of the screen buffer, which is useful for performing smooth, simple animation; and to wait while reading console input until a key is pressed. Other new class members control the foreground and background colors of text, the visibility and size of the cursor, and the frequency and duration of the console beep.

Data Protection API

The new Data Protection API (DPAPI) includes four methods that allow applications to encrypt passwords, keys, connections strings, and so on, without calling platform invoke. You can also encrypt blocks of memory on computers running Windows Server 2003 or later operating systems.

Debugger Display Attributes

You can now control how Visual Studio displays a class or member when an application is being debugged. The debugger's Display Attributes feature enables you to identify the most useful information to display in the debugger.

Debugger Edit and Continue Support

The .NET Framework 2.0 reintroduces the Edit and Continue feature that enables a user who is debugging an application in Visual Studio to make changes to source code while executing in Break mode. After source code edits are applied, the user can resume code execution and observe the effect. Furthermore, the Edit and Continue feature is available in any programming language supported by Visual Studio.

Detecting Changes in Network Connectivity

The NetworkChange class allows applications to receive notification when the Internet Protocol (IP) address of a network interface, also known as a network card or adapter, changes. An interface address can change for a variety of reasons, such as a disconnected network cable, moving out of range of a wireless local area network, or hardware failure. The NetworkChange class provides address change notification by raising events when a change is detected.

Distributed Computing

In the System.Net namespace, support has been added for FTP client requests, caching of HTTP resources, automatic proxy discovery, and obtaining network traffic and statistical information. The namespace now includes a Web server class (HttpListenerfrlrfSystemNetHttpWebListenerClassTopic) that you can use to create a simple Web server for responding to HTTP requests. Classes that generate network traffic have been instrumented to output trace information for application debugging and diagnostics. Security and performance enhancements have been added to the System.Net.Sockets.Socket and System.Uri classes.

In the System.Web.Services namespaces, support for SOAP 1.2 and nullable elements has been added.

In the System.Runtime.Remoting.Channels namespaces, channel security features have been added. The TCP channel now supports authentication and encryption, as well as several new features to better support load balancing.

EventLog Enhancements

You can now use custom DLLs for EventLog messages, parameters, and categories.

Expanded Certificate Management

The .NET Framework now supports X.509 certificate stores, chains, and extensions. In addition, you can sign and verify XML using X.509 certificates without using platform invoke. There is also support for PKCS7 signature and encryption, and CMS (a superset of the PKCS7 standard available on Microsoft Windows 2000 and later operating systems). PKCS7 is the underlying format used in Secure/Multipurpose Internet Mail Extensions (S/MIME) for signing and encrypting data. For more information, see the X509Certificate2 class topic.

FTP Support

Applications can now access File Transfer Protocol resources using the WebRequest, WebResponse, and WebClient classes.

Generics and Generic Collections

The .NET Framework 2.0 introduces generics to allow you to create flexible, reusable code. Language features collectively known as generics act as templates that allow classes, structures, interfaces, methods, and delegates to be declared and defined with unspecified, or generic type parameters instead of specific types. Actual types are specified later when the generic is used. Several namespaces, such as System Namespace and System.Collections.Generic, provide generic classes and methods. The new System.Collections.Generic namespace provides support for strongly typed collections. System.Nullable<T> is a standard representation of optional values. Generics are supported in three languages: Visual Basic, C#, and C++.

Reflection has been extended to allow runtime examination and manipulation of generic types and methods. New members have been added to System.Type and System.Reflection.MethodInfo, including IsGenericType to identify generic types (for example, class Gen<T,U> {...}), GetGenericArguments to obtain type parameter lists, and MakeGenericType to create specific types (for example, new Gen<int, long>()).

Globalization

Five new globalization features provide greater support for developing applications intended for different languages and cultures.

  • Support for custom cultures enables you to define and deploy culture-related information as needed. This feature is useful for creating minor customizations of existing culture definitions, and creating culture definitions that do not yet exist in the .NET Framework. For more information, see the CultureAndRegionInfoBuilder class.

  • Encoding and decoding operations map a Unicode character to or from a stream of bytes that can be transferred to a physical medium such as a disk or a communication line. If a mapping operation cannot be completed, you can compensate by using the new encoding and decoding fallback feature supported by several classes in the System.Text namespace.

  • Members in the UTF8Encoding class, which implements UTF-8 encoding, are now several times faster than in previous releases. UTF-8 is the most common encoding used to transform Unicode characters into bytes on computers.

  • The .NET Framework now supports the latest normalization standard defined by the Unicode Consortium. The normalization process converts character representations of text to a standard form so the representations can be compared for equivalence.

  • The GetCultureInfo method overload provides a cached version of a read-only CultureInfo object. Use the cached version when creating a new CultureInfo object to improve system performance and reduce memory usage.

I/O Enhancements

Improvements have been made to the usability and functionality of various I/O classes. It is now easier for users to read and write text files and obtain information about a drive.

You can now use the classes in the System.IO.Compression namespace to read and write data with the GZIP compression and decompression standard, described in the IETF RFC 1951 and RFC 1952 specifications, which are available at the IETF Request for Comments (RFC) search page. Note: search is limited to RFC numbers.

Manifest-Based Activation

This feature provides new support for loading and activating applications through the use of a manifest. Manifest-based activation is essential for supporting ClickOnce applications. Traditionally, applications are activated through a reference to an assembly that contains the application's entry point. For example, clicking an application's .exe file from within the Windows shell causes the shell to load the common language runtime (CLR) and call a well-known entry point within that .exe file's assembly.

The manifest-based activation model uses an application manifest for activation rather than an assembly. A manifest fully describes the application, its dependencies, security requirements, and so forth. The manifest model has several advantages over the assembly-based activation model, especially for Web applications. For example, the manifest contains the security requirements of the application, which enables the user to decide whether to allow the application to execute before downloading the code. The manifest also contains information about the application dependencies.

Manifest-based activation is provided by a set of APIs that allow managed hosts to activate applications and add-ins described by a manifest. These APIs contain a mixture of both new classes and extensions to existing classes.

This activation model also invokes an entity called a Trust Manager that performs the following tasks:

  1. Determines whether an application is allowed to be activated. This decision can be made by prompting the user, querying policy, or by any other means deemed appropriate for a given Trust Manager.

  2. Sets up the security context to run an application in. Most commonly, this step involves setting up a code access security (CAS) policy tree on the application domain in which the application will run.

.NET Framework Remoting

.NET Framework remoting now supports IPv6 addresses and the exchange of generic types. The classes in the System.Runtime.Remoting.Channels.Tcp namespace support authentication and encryption using the Security Support Provider Interface (SSPI). Classes in the new System.Runtime.Remoting.Channels.Ipc namespace allow applications on the same computer to communicate quickly without using the network. Finally, you can now configure the connection cache time-out and the number of method retries, which can improve the performance of network load-balanced remote clusters.

Obtaining Information About Local Computer Network Configuration and Usage

Using classes in the System.Net.NetworkInformation namespace, applications can access IP, IPv4, IPv6, TCP, and UDP network traffic statistics. Applications can also view address and configuration information for the local computer’s network adapters. This information is similar to the information returned by the Ipconfig.exe command-line tool.

Ping

The Ping class allows an application to determine whether a remote computer is accessible over the network. This class provides functionality similar to the Ping.exe command-line tool, and supports synchronous and asynchronous calls.

Processing HTTP Requests from Within Applications

You can use the HttpListener class to create a simple Web server that responds to HTTP requests. The Web server is active for the lifetime of the HttpListener object and runs within your application, with your application's permissions. This class is available only on computers running the Windows XP Service Pack 2 or Windows Server 2003 operating systems.

Programmatic Control of Caching

Using the classes in the System.Net.Cache namespace, applications can control the caching of resources obtained using the WebRequest, WebResponse, and WebClient classes. You can use the predefined cache policies provided by the .NET Framework or specify a custom cache policy. You can specify a cache policy for each request and define a default cache policy for requests that do not specify a cache policy.

Programming Languages

Four Microsoft programming languages explicitly target the .NET Framework. For more information about new and enhanced features in these languages, see the following topics:

What's New in C# 2.0

What's New in the Visual J# Language

What's New in the Microsoft C/C++ Language

What's New in the Visual Basic Language

Visual Basic Compiler and Language

Language improvements in Visual Basic simplify source code and enable interaction with components that use advanced features.

Compiler

Visual Basic introduces a new conditional compilation constant, VBC_VER, for all projects. This version has the value of VBC_VER 8.0.

The Visual Basic command-line compiler now stores the default command-line options in the Vbc.rsp file, in the same directory as the command-line compiler (Vbc.exe). You can edit Vbc.rsp to reconfigure the default command-line options.

There are four new command-line compiler options:

  • The /doc option generates an XML documentation file based on comments within your code.

  • The /noconfig option causes the compiler to ignore the Vbc.rsp file.

  • The /codepage option specifies which codepage to use when opening source files.

  • The /filealign option specifies the size of sections in your output file.

  • The /nostdlib (Visual Basic) option causes the compiler not to reference the standard libraries.

For more information, see Visual Basic Compiler Options.

Language

There are several new elements in this version of the Visual Basic language:

  • Continue Statement

  • Operator Statement

  • Using Statement

  • IsFalse Operator

  • IsNot Operator

  • IsTrue Operator

  • SByte Data Type

  • UInteger Data Type

  • ULong Data Type

  • UShort Data Type

  • Global

  • Of

  • Narrowing

  • Widening

  • Partial (Visual Basic)

  • Custom

Security Exceptions

The System.Security.SecurityException class has been expanded to provide additional data that facilitates investigation into the cause of security exceptions. New properties provide information that includes the method in which the exception occurred, the first permission that failed, the zone or URL of the assembly, the security action that failed, and the security action on the call stack, such as Deny or PermitOnly, that caused the exception.

Serial I/O Device Support

The new SerialPort class provides applications with the ability to access the serial ports on a computer and to communicate with serial I/O devices.

Serialization

The BinaryFormatter and SoapFormatter classes now support version-tolerant serialization, which allows a type to be deserialized from the serialization of a different version. For more details, see Version Tolerant Serialization.

XML serialization now supports the use of properties instead of fields to represent schema elements, the serialization of generic types, and the use of the Nullable structure to represent nullable elements. The IXmlSerializable interface supports custom schema generation. The SchemaImporterExtension allows you to control proxy code generation by altering schemas during schema importation. For example, you can alter the proxy generated when using the Add Web Reference feature of Visual Studio, or when using the Web Services Description Language Tool (Wsdl.exe).

The new XML Serializer Generator Tool (Sgen.exe) allows you to precompile the code used by Web services clients to serialize transmitted information, which greatly improves the client startup time. For more details, see Introducing XML Serialization.

SMTP Support

Using the classes in the System.Net.Mail and System.Net.Mime namespaces, applications can send e-mail to one or more recipients. Mail can be sent with alternate views and can include attachments. Sending carbon copies and blind carbon copies is also supported.

Strongly Typed Resource Support

The Resource File Generator (Resgen.exe) creates resource files that are embedded in executable files and satellite assemblies. Resgen.exe produces a wrapper class for each resource file, which gives you easy access to resources and prevents spelling mistakes in resource names.

Threading Improvements

You can now name cross-process communication events that are created purely in managed code. The Semaphore class also supports specialized resource counting.

Trace Data Filtering

The .NET Framework 2.0 provides classes that trace and log system events related to I/O, application startup and shutdown, and so on. However, the enormous volume and diverse types of trace information make it difficult for users to analyze this data. New support for trace data filtering enables you to specify the type of information to log.

Transactions

The new System.Transactions namespace contains classes that allow your applications to participate in transactions managed by the Microsoft Distributed Transaction Coordinator (MSDTC) or the local transaction manager. The System.Transactions namespace provides both an explicit programming model based on the Transaction class, and an implicit programming model using the TransactionScope class, in which transactions are automatically managed by the infrastructure. This transaction infrastructure can easily interoperate with the existing System.EnterpriseServices (COM+) transaction infrastructure. The System.Transactions namespace also provides classes for implementing a resource manager. A resource manager manages durable or volatile data used in a transaction, and works in cooperation with the transaction manager to provide the application with a guarantee of atomicity and isolation.

Web Services

Web services support SOAP 1.2 and the WS-I Basic Profile 1.0, which is documented at "Web Services Interoperability Organization - Basic Profile Version 1.0".

When consuming two or more Web services that define a shared type, the client proxies generated for those Web services share the corresponding type on the client. This allows clients to easily pass instances of shared types among Web services.

You can now invoke Web methods asynchronously using an event-based programming pattern.

Windows Forms–Related Features

ClickOnce Deployment

ClickOnce deployment allows you to deploy self-updating Windows applications that can be installed and run as easily as Web applications. You can deploy Windows client and command-line applications. There are new Publish Project commands on the Build and Project menus in Visual Studio. For more information, see ClickOnce Deployment Overview.

Application Settings

Application settings for Windows Forms make it easy to create, store, and maintain custom application and user preferences on the client. With Windows Forms settings, you can store not only application data, such as database connection strings, but also user-specific data, such as toolbar positions and most-recently-used lists. For more information, see Application Settings Overview.

New Data-Binding Model

The BindingSource component simplifies the process of data binding because it acts as an intermediary between the bound control and the target data source. It automatically manages many of the more difficult binding issues such as currency, data-related events, and target data source changes. It is also designed to interoperate with other data-related Windows Forms controls, particularly the BindingNavigator and the DataGridView controls. For more information, see BindingSource Component. The BindingSource component simplifies the process of binding controls to an underlying data source. It acts as both a conduit and a data source to which other controls bind.

New Windows Forms Controls

The DataGridView control provides a powerful and flexible way to display data in a tabular format. It can be used to show read-only views of a small amount of data or it can be scaled to show editable views of very large sets of data. The data can reside in an external data source or be added directly to the control. For more information, see DataGridView Control Overview (Windows Forms).

ToolStrip controls are toolbars that can host menus, controls, and user controls in your Windows Forms applications. The ToolStrip class and its associated classes enable you to create toolbars and other user interface elements in a style that is consistent with Microsoft Windows XP, Microsoft Office, and Microsoft Internet Explorer. You can also use these classes to customize toolbars and user interface elements. For more information, see ToolStrip Control Overview (Windows Forms).

The MaskedTextBox control uses a mask definition to distinguish between valid and invalid user input. For more information, see MaskedTextBox Control (Windows Forms).

The Windows Forms SoundPlayer class enables you to easily include sounds in your applications. The SoundPlayer class can play sound files in the .wav format, either from a resource or from Universal Naming Conventions (UNC) or HTTP locations. Additionally, the SoundPlayer class enables you to load or play sounds asynchronously. For more information, see SoundPlayer Class.

The Windows Forms SplitContainer control can be thought of as a composite; it is two panels separated by a movable bar. When the mouse pointer hovers over the bar, the cursor changes to show that the bar is movable. Use this control to create complex, resizable user interfaces that are effective for displaying and browsing information. For more information, see SplitContainer Control.

The ListView control now supports three features provided by Windows XP and the Windows Server 2003 family: tile view, grouping, and drag-and-drop item repositioning.

The ListView, TreeView, and ToolTip controls now support owner drawing functionality similar to the owner drawing support for the ComboBox, ListBox, MenuItem, and TabControl controls in the previous release.

The WebBrowser control lets you host Web pages in your Windows Forms applications. You can use the WebBrowser control to provide integrated HTML-based Help or Internet Web browsing capabilities in your application. Additionally, you can use the WebBrowser control to convert existing Web applications to client applications that seamlessly integrate dynamic HTML (DHTML) code with the user interface capabilities of Windows Forms. For more information, see WebBrowser Control Overview.

The FlowLayoutPanel control arranges its contents in a horizontal or vertical flow direction. The TableLayoutPanel control arranges its contents in a grid. Because the layout is performed both at design time and run time, it can change dynamically as the application environment changes. For more information, see FlowLayoutPanel Control Overview and TableLayoutPanel Control Overview.

The BackgroundWorker component enables you to perform operations in the background that can take a long time to execute, such as image downloads and database transactions. For more information, see BackgroundWorker Component Overview.

The Asynchronous Pattern for Components is an event-driven model that provides the advantages of multithreaded applications while hiding many of the complex issues inherent in multithreaded design. For more information, see Asynchronous Pattern for Components.

XML-Related Features

The .NET Framework 2.0 provides many enhancements, including a new XSL Transformation (XSLT) processor; type support in the XmlReader, XmlWriter, and XPathNavigator classes; and new editing capabilities in the XPathNavigator class. In addition, there is a new model for creating XmlReader and XmlWriter objects, and many performance improvements. For more information, see What's New in System.Xml.