91久久亚洲综合精品成人a_av有码中文字幕在线_国产精品日本一区二区不卡视频_亚洲国产综合在一区_女人与公拘交酡过程_免费看色片软件下载_曰批全过程120分钟免费_国产偷窥熟女高潮

http://m.ggcaomm.cn/upload/images/2021/5/608eb46776ccaee5.jpg

.NET 7 預覽版 2 正式發布:RegEx 源生成器增強、NativeAOT 更新

2022-03-21

3月15號, .NET 7 預覽版 2正式發布,距預覽版 1 發布已過去將近一個月的時間。.NET 7 的第二個預覽版包括對 RegEx 源生成器的增強、將 NativeAOT 從實驗狀態轉移到運行時的進展,以及對“dotnet new”CLI 體驗的一系列重大改進。


主要更新內容


引入新的正則表達式源生成器


新的正則表達式源生成器(Issues 44676)在無需增加啟動成本的情況下,為編譯帶來了許多性能上的好處,還提供了良好的調試體驗。


要開始使用新的正則表達式源生成器,只需將包含類型轉換為分部(partial)類型,并使用 RegexGenerator 屬性聲明一個新的分部方法。該方法將返回優化的 Regex 對象,源生成器將自動填充該方法的實現,并在更改模式或傳遞其他選項時自動更新。例如:


之前:


public class Foo{
  public Regex regex = new Regex(@"abc|def", RegexOptions.IgnoreCase);

  public bool Bar(string input)
  {
    bool isMatch = regex.IsMatch(input);
    // ..
  }}

現在:


public partial class Foo  // <-- Make the class a partial class{
  [RegexGenerator(@"abc|def", RegexOptions.IgnoreCase)] // <-- Add the RegexGenerator attribute and pass in your pattern and options
  public static partial Regex MyRegex(); //  <-- Declare the partial method, which will be implemented by the source generator

  public bool Bar(string input)
  {
    bool isMatch = MyRegex().IsMatch(input); // <-- Use the generated engine by invoking the partial method.
    // ..
  }}


SDK 改進


新的 CLI 解析器 + 選項卡完成 #2191


.NET 新命令為用戶已經使用的許多子命令提供了更加一致和直觀的界面。此外,對模板選項和參數的 TAB 補全的支持已得到大量更新,在用戶鍵入時對有效參數和選項提供快速反饋。以下是新的幫助輸出示例:


? dotnet new --help
Description:
  Template Instantiation Commands for .NET CLI.Usage:
  dotnet new [<template-short-name> [<template-args>...]] [options]
  dotnet new [command] [options]Arguments:
  <template-short-name>  A short name of the template to create.
  <template-args>        Template specific options to use.Options:
  -?, -h, --help  Show command line help.Commands:
  install <package>       Installs a template package.
  uninstall <package>     Uninstalls a template package.
  update                  Checks the currently installed template packages for update, and install the updates.
  search <template-name>  Searches for the templates on NuGet.org.
  list <template-name>    Lists templates containing the specified template name. If no name is specified, lists all templates.


新命令名稱


幫助輸出中的所有命令不再具有 -- 前綴,這更符合用戶對 CLI 應用程序中子命令的期望。舊版本(--install 等)仍可用于防止破壞用戶腳本,將來會在這些命令中添加過時警告以鼓勵遷移。


Tab 補全


dotnet CLI 在 PowerShell、bash、zsh 和 fish 等流行的 shell 上支持 tab 補全已經有一段時間了。然而,實現有意義的補全取決于單獨的 dotnet 命令。對于 .NET 7,新命令學習了如何提供 Tab 補全:


  • 可用的模板名稱(在 dotnet new <template-short-name> 中)



? dotnet new angular
angular              grpc                 razor                viewstart            worker               -h
blazorserver         mstest               razorclasslib        web                  wpf                  /?
blazorwasm           mvc                  razorcomponent       webapi               wpfcustomcontrollib  /h
classlib             nugetconfig          react                webapp               wpflib               install
console              nunit                reactredux           webconfig            wpfusercontrollib    list
editorconfig         nunit-test           sln                  winforms             xunit                search
gitignore            page                 tool-manifest        winformscontrollib   --help               uninstall
globaljson           proto                viewimports          winformslib          -?                   update


  • 模板選項(Web 模板中的模板選項列表)



? dotnet new web --dry-run
--dry-run                  --language                 --output                   -lang
--exclude-launch-settings  --name                     --type                     -n
--force                    --no-https                 -?                         -o
--framework                --no-restore               -f                         /?--help                     --no-update-check          -h                         /h


模板選項的允許值(選擇模板參數上的選擇值)

? dotnet new blazorserver --auth IndividualIndividual     IndividualB2C  MultiOrg       None           SingleOrg      Windows



NativeAOT 更新


將 NativeAOT 從實驗性 dotnet/runtimelab 存儲庫中移出 并進入穩定的運行時庫 dotnet/runtime repo,但尚未在 dotnet SDK 中添加一流的支持,以使用 NativeAOT 發布項目。 


來源:Dotnet9
相關內容[ { "imageUrlCount": 0, "videoUrlCount": 0, "fileUrlCount": 0, "channelId": 24, "siteId": 1, "adminId": 2, "lastEditAdminId": 2, "userId": 0, "taxis": 484, "groupNames": [], "tagNames": [ ".NET 7" ], "sourceId": 0, "referenceId": 0, "templateId": 0, "checked": true, "checkedLevel": 0, "hits": 0, "hitsByDay": 0, "hitsByWeek": 0, "hitsByMonth": 0, "lastHitsDate": null, "downloads": 0, "title": ".NET 7 預覽版 2 正式發布:RegEx 源生成器增強、NativeAOT 更新", "subTitle": "", "seoTitle": null, "imageUrl": "", "videoUrl": "", "fileUrl": "", "keywords": null, "description": null, "body": "

3月15號, .NET 7 預覽版 2正式發布,距預覽版 1 發布已過去將近一個月的時間。.NET 7 的第二個預覽版包括對 RegEx 源生成器的增強、將 NativeAOT 從實驗狀態轉移到運行時的進展,以及對“dotnet new”CLI 體驗的一系列重大改進。


主要更新內容


引入新的正則表達式源生成器


新的正則表達式源生成器(Issues 44676)在無需增加啟動成本的情況下,為編譯帶來了許多性能上的好處,還提供了良好的調試體驗。


要開始使用新的正則表達式源生成器,只需將包含類型轉換為分部(partial)類型,并使用 RegexGenerator 屬性聲明一個新的分部方法。該方法將返回優化的 Regex 對象,源生成器將自動填充該方法的實現,并在更改模式或傳遞其他選項時自動更新。例如:


之前:


public class Foo{
  public Regex regex = new Regex(@"abc|def", RegexOptions.IgnoreCase);

  public bool Bar(string input)
  {
    bool isMatch = regex.IsMatch(input);
    // ..
  }}

現在:


public partial class Foo  // <-- Make the class a partial class{
  [RegexGenerator(@"abc|def", RegexOptions.IgnoreCase)] // <-- Add the RegexGenerator attribute and pass in your pattern and options
  public static partial Regex MyRegex(); //  <-- Declare the partial method, which will be implemented by the source generator

  public bool Bar(string input)
  {
    bool isMatch = MyRegex().IsMatch(input); // <-- Use the generated engine by invoking the partial method.
    // ..
  }}


SDK 改進


新的 CLI 解析器 + 選項卡完成 #2191


.NET 新命令為用戶已經使用的許多子命令提供了更加一致和直觀的界面。此外,對模板選項和參數的 TAB 補全的支持已得到大量更新,在用戶鍵入時對有效參數和選項提供快速反饋。以下是新的幫助輸出示例:


? dotnet new --help
Description:
  Template Instantiation Commands for .NET CLI.Usage:
  dotnet new [<template-short-name> [<template-args>...]] [options]
  dotnet new [command] [options]Arguments:
  <template-short-name>  A short name of the template to create.
  <template-args>        Template specific options to use.Options:
  -?, -h, --help  Show command line help.Commands:
  install <package>       Installs a template package.
  uninstall <package>     Uninstalls a template package.
  update                  Checks the currently installed template packages for update, and install the updates.
  search <template-name>  Searches for the templates on NuGet.org.
  list <template-name>    Lists templates containing the specified template name. If no name is specified, lists all templates.


新命令名稱


幫助輸出中的所有命令不再具有 -- 前綴,這更符合用戶對 CLI 應用程序中子命令的期望。舊版本(--install 等)仍可用于防止破壞用戶腳本,將來會在這些命令中添加過時警告以鼓勵遷移。


Tab 補全


dotnet CLI 在 PowerShell、bash、zsh 和 fish 等流行的 shell 上支持 tab 補全已經有一段時間了。然而,實現有意義的補全取決于單獨的 dotnet 命令。對于 .NET 7,新命令學習了如何提供 Tab 補全:


  • 可用的模板名稱(在 dotnet new <template-short-name> 中)



? dotnet new angular
angular              grpc                 razor                viewstart            worker               -h
blazorserver         mstest               razorclasslib        web                  wpf                  /?
blazorwasm           mvc                  razorcomponent       webapi               wpfcustomcontrollib  /h
classlib             nugetconfig          react                webapp               wpflib               install
console              nunit                reactredux           webconfig            wpfusercontrollib    list
editorconfig         nunit-test           sln                  winforms             xunit                search
gitignore            page                 tool-manifest        winformscontrollib   --help               uninstall
globaljson           proto                viewimports          winformslib          -?                   update


  • 模板選項(Web 模板中的模板選項列表)



? dotnet new web --dry-run
--dry-run                  --language                 --output                   -lang
--exclude-launch-settings  --name                     --type                     -n
--force                    --no-https                 -?                         -o
--framework                --no-restore               -f                         /?--help                     --no-update-check          -h                         /h


模板選項的允許值(選擇模板參數上的選擇值)

? dotnet new blazorserver --auth IndividualIndividual     IndividualB2C  MultiOrg       None           SingleOrg      Windows



NativeAOT 更新


將 NativeAOT 從實驗性 dotnet/runtimelab 存儲庫中移出 并進入穩定的運行時庫 dotnet/runtime repo,但尚未在 dotnet SDK 中添加一流的支持,以使用 NativeAOT 發布項目。 


", "summary": "3月15號, .NET 7 預覽版 2正式發布", "author": "", "source": "Dotnet9", "top": false, "recommend": false, "hot": false, "color": false, "linkUrl": null, "addDate": "2022-03-21 09:45:00", "price": 0.0, "oldPrice": 0.0, "stockQuantity": 0, "priceUnit": null, "isMainContent": true, "allowAddSubContent": false, "relatedContentId": 0, "subContentNum": 0, "mainContent": null, "subContents": null, "attributeIds": null, "attributeValueIds": null, "id": 722, "guid": "1fd7aa33-6cc8-4daf-8d8a-9c2afd1277f6", "createdDate": "2022-03-21 09:47:18", "lastModifiedDate": "2022-03-21 09:47:18" } ]