Summary of new features of. Net Framework versions (1). New Features of the framework

Source: Internet
Author: User
Tags expression engine

Summary of new features of. Net Framework versions (1). New Features of the framework

New Features of. Net Framework 4.5

I was asked about the new features of. Net Framework during my recent interview. It is usually used when it is picked up. The new version comes out, and the new features are just a glance. I didn't check them carefully. This time, I will take some time to summarize the new features of each version compared to the previous version. The main reference source is MSDN. Here is the original article link:

Reference: https://msdn.microsoft.com/en-us/library/ms171868 (v = vs.110). aspx # core

Well, we started from 4.5.

Directory Table Of Content

1. Core new features and improvements in this article

2. Managed extension framework

3. asynchronous file operations

4. Tools

5. Parallel Computing

6. Website

7. Network Programming

8. WPF

9. WCF

10. WF

11. Portable Class Libraries

 

1. core features and Improvements

1). The need for system restart is reduced when Framework 4.5 is installed. Part of the 4.5 files must be replaced during installation. Therefore, these files must be replaced (writable) during installation ). 4.5 introduced a Restart Manager, which can detect running 4.0 programs and try to close these programs (a prompt box will show you to confirm the program to be closed ), to avoid restarting the system. However, if some programs cannot or should not be closed, restart the system.

If you want to release your own program and bring your own Framework installation package (Chained Instaler), you can also set the command line option so that the user can install your package. the prompt box for closing the program that comes with the Framework.

Reference: https://msdn.microsoft.com/en-us/library/hh527997 (v = vs.110). aspx

PS: This new feature seems to be of little use. It doesn't matter if the development environment is heavy and the system is not restarted. You can also take a look at the headlines when restarting. If the production environment does not require 100% restart, it does not seem to play a major role.

2). The 64-bit system supports a large array larger than 2 GB. However, if this feature is available, you need to set gcAllowVeryLargeObjects configuration items in the configuration file:


<configuration>
  <runtime>
    <gcAllowVeryLargeObjects enabled="true" />
  </runtime>
</configuration>

PS: no such large array is used. In what scenarios will such a large array be used?

3). Start to support Background garbage collection of servers. Background garbage collection starts from 4.0, but only supports WorkStation environments. Server Support started from 4.5. Garbage collection will automatically adapt to different scenarios. We can follow the workload characteristics. Modify the configuration file settings to set the garbage collection type. Currently, CLR provides two types of garbage collection: workbench and server.

Workbench garbage collection is applicable to various client workstations and independent PCs. It is the default setting of <runtime>/<gcserver> in the configuration file. It can run in concurrent or non-concurrent mode. In concurrent mode, garbage collection and hosting of the main thread run simultaneously. From 4.0, background garbage collection replaces concurrent garbage collection.

Server garbage collection is suitable for high-throughput and Scalable Server applications. Server garbage collection can be non-concurrent or backend.

For background garbage collection, it will be executed in a separate thread, and garbage collection will only be executed on two generations of stacks.

The objects of generation 0 and generation 1 (ephemeral generations) use Foreground Garbage colletion. When the Foreground Garbage collection starts, both the background garbage collection thread and the main program thread will be suspended until the collection is completed and then restored.

Reference: https://msdn.microsoft.com/en-us/library/ee787088 (v = vs.110). aspx # background_garbage_collection

4). On a multi-core processor system, you can support Background JIT compilation to speed up program startup.

Reference: https://msdn.microsoft.com/en-us/library/system.runtime.profileoptimization (v = vs.110). aspx

5) You can set the timeout time of the Regular Expression Engine. In earlier versions, there was no timeout. This time can be set to apply to all Regex objects in the AppDomain. The default value is Regex. InfiniteMatchTimeout without timeout.

using System;
using System.Text.RegularExpressions;

public class Example
{
   public static void Main()
   {
      AppDomain domain = AppDomain.CurrentDomain;
      // Set a timeout interval of 2 seconds.
      domain.SetData("REGEX_DEFAULT_MATCH_TIMEOUT", TimeSpan.FromSeconds(2));
      Object timeout = domain.GetData("REGEX_DEFAULT_MATCH_TIMEOUT");
      Console.WriteLine("Default regex match timeout: {0}",
                         timeout == null ? "<null>" : timeout);

      Regex rgx = new Regex("[aeiouy]");
      Console.WriteLine("Regular expression pattern: {0}", rgx.ToString());
      Console.WriteLine("Timeout interval for this regex: {0} seconds",
                        rgx.MatchTimeout.TotalSeconds);
   }
}
// The example displays the following output:
//       Default regex match timeout: 00:00:02
//       Regular expression pattern: [aeiouy]
//       Timeout interval for this regex: 2 seconds

Reference: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.matchtimeout (v = vs.110). aspx

6). You can set the default Culture for AppDomain.

Reference: https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo (v = vs.110). aspx

7). The Console supports UTF-16 encoding.

8). String sorting and comparison support encoding of different cultural versions.

9). Read resources with better performance.

10). Improved Zip compression to reduce the size of the compressed file.

11). You can customize a reflection context to overwrite the default reflection behavior. The purpose of reflection context is to provide an Attribute for modifying the Member or method of the reflected type at runtime ). for example, add a source code with no attribute, or remove the attribute in the source code. In this way, custom attributes are obtained when attributes of type members or methods are obtained through reflection.

Reference: https://msdn.microsoft.com/en-us/library/system.reflection.context.customreflectioncontext (v = vs.110). aspx

12 ). when the class is System. globalization. idnMapping is used on Win8 and supports IDNA 2008 (Internationalized Domain Names in Applications ). class System. globalization. idnMapping is an Internet domain name that supports non-ASCII encoding.

Reference: https://msdn.microsoft.com/en-us/library/system.globalization.idnmapping (v = vs.110). aspx

13) When. Net Framework runs on Win8, string comparison will be performed on the operating system that implements Unicode 6.0. If you are running on another platform, the. Net Framework uses its own string for comparison, which is based on Unicode5.X.

14). The string hash code can be calculated based on the application domain.

15). Type reflection supports splitting between the Type and TypeInfo classes.

 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.