{"id":1046,"date":"2025-03-06T22:47:15","date_gmt":"2025-03-07T06:47:15","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/?p=1046"},"modified":"2025-03-06T22:47:15","modified_gmt":"2025-03-07T06:47:15","slug":"net-maui%e5%9c%a8-net-9-%e4%b8%ad%e7%9a%84%e6%80%a7%e8%83%bd%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/net-maui%e5%9c%a8-net-9-%e4%b8%ad%e7%9a%84%e6%80%a7%e8%83%bd%e5%8a%9f%e8%83%bd\/","title":{"rendered":".NET MAUI\u5728 .NET 9 \u4e2d\u7684\u6027\u80fd\u529f\u80fd"},"content":{"rendered":"<p style=\"text-align: center;\"><em><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\">\u672c\u6587\u7ffb\u8bd1\u81ea <a class=\"read-more\" href=\"https:\/\/devblogs.microsoft.com\/dotnet\/author\/jopepper\" data-bi-area=\"body_author_top\" data-bi-id=\"post_page_body_author_top_name\" data-bi-name=\"Jonathan\">Jonathan<\/a> \u548c\u00a0<a class=\"read-more\" href=\"https:\/\/devblogs.microsoft.com\/dotnet\/author\/srozsival\" data-bi-area=\"body_author_top\" data-bi-id=\"post_page_body_author_top_name\" data-bi-name=\"Simon\">Simon<\/a> \u7684 .<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-9-performance-improvements-in-dotnet-maui\/\">NET MAUI Performance Features in .NET 9<\/a><\/span><\/em><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">.NET \u591a\u5e73\u53f0\u5e94\u7528 UI (.NET MAUI) \u968f\u7740\u5404\u4e2a\u7248\u672c\u7684\u53d1\u5e03\u800c\u4e0d\u65ad\u53d1\u5c55\uff0c\u4e0e\u6b64\u540c\u65f6\uff0c.NET 9 \u91cd\u70b9\u5f15\u5165\u4e86\u88c1\u526a\u529f\u80fd\u548c\u4e00\u4e2a\u65b0\u7684\u53d7\u652f\u6301\u8fd0\u884c\u65f6\uff1aNativeAOT\u3002\u8fd9\u4e9b\u529f\u80fd\u53ef\u4ee5\u5e2e\u52a9\u60a8\u51cf\u5c11\u5e94\u7528\u7a0b\u5e8f\u5927\u5c0f\u3001\u63d0\u9ad8\u542f\u52a8\u901f\u5ea6\uff0c\u5e76\u786e\u4fdd\u5e94\u7528\u7a0b\u5e8f\u5728\u5404\u4e2a\u5e73\u53f0\u4e0a\u6d41\u7545\u8fd0\u884c\u3002\u65e0\u8bba\u662f\u5e0c\u671b\u4f18\u5316 .NET MAUI \u5e94\u7528\u7684\u5f00\u53d1\u8005\uff0c\u8fd8\u662f NuGet \u5305\u7684\u4f5c\u8005\uff0c\u90fd\u53ef\u4ee5\u5728 .NET 9 \u4e2d\u4f7f\u7528\u8fd9\u4e9b\u529f\u80fd\u3002<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6211\u4eec\u8fd8\u5c06\u5411\u5f00\u53d1\u4eba\u5458\u4ecb\u7ecd\u53ef\u7528\u4e8e\u6d4b\u91cf .NET MAUI \u5e94\u7528\u7a0b\u5e8f\u6027\u80fd\u7684\u9009\u9879\u3002CPU \u91c7\u6837\u548c\u5185\u5b58\u5feb\u7167\u53ef\u5206\u522b\u901a\u8fc7 <code>dotnet-trace<\/code> \u548c <code>dotnet-gcdump<\/code> \u83b7\u5f97\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u60a8\u6df1\u5165\u4e86\u89e3\u5e94\u7528\u7a0b\u5e8f\u3001NuGet \u5305\u7684\u6027\u80fd\u95ee\u9898\uff0c\u751a\u81f3\u662f\u6211\u4eec\u9700\u8981\u5173\u6ce8\u7684 .NET MAUI \u95ee\u9898\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u80cc\u666f<\/b><\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c iOS \u548c Android \u4e0a\u7684 .NET MAUI \u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u4ee5\u4e0b\u8bbe\u7f6e\uff1a\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"6\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u201c\u81ea\u5305\u542b\u201d: \u610f\u5473\u7740\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5305\u542b BCL \u548c\u8fd0\u884c\u65f6\u7684\u526f\u672c\u3002\u00a0<\/span><\/li>\n<\/ul>\n<p data-ccp-border-top=\"0.6666666666666666px solid #000000\" data-ccp-padding-top=\"5.333333333333333px\"><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>\u6ce8\u610f<\/strong><\/p>\u8fd9\u4f7f\u5f97 .NET MAUI \u5e94\u7528\u7a0b\u5e8f\u9002\u5408\u5728\u201c\u5e94\u7528\u5546\u5e97\u201d\u4e0a\u8fd0\u884c\uff0c\u56e0\u4e3a\u4e0d\u9700\u8981\u5b89\u88c5 .NET \u8fd0\u884c\u65f6\u7b49\u5148\u51b3\u6761\u4ef6\u3002\u00a0<\/div><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"5\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u90e8\u5206\u88c1\u526a\uff08<code>TrimMode=partial<\/code>\uff09\uff0c\u610f\u5473\u7740\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u4fee\u526a\u5e94\u7528\u7a0b\u5e8f\u6216 NuGet \u5305\u4e2d\u7684\u4ee3\u7801\u3002\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\" data-ccp-props=\"{}\"> <div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>\u6ce8\u610f<\/strong><\/p>\u8fd9\u662f\u5f88\u597d\u7684\u9ed8\u8ba4\u8bbe\u7f6e\uff0c\u56e0\u4e3a\u5b83\u4e0e\u751f\u6001\u7cfb\u7edf\u4e2d\u73b0\u6709\u7684\u4ee3\u7801\u548c NuGet \u5305\u6700\u4e3a\u517c\u5bb9\u3002 <\/div><\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u5b8c\u5168\u88c1\u526a<\/b><\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8fd9\u5c31\u662f\u5b8c\u5168\u88c1\u526a\uff08<code>TrimMode=full<\/code>\uff09\u80fd\u5f71\u54cd\u5e94\u7528\u7a0b\u5e8f\u5927\u5c0f\u7684\u5730\u65b9\u3002\u5982\u679c\u60a8\u7684\u5e94\u7528\u5305\u542b\u5927\u91cf C# \u4ee3\u7801\u6216 NuGet \u5305\uff0c\u60a8\u53ef\u80fd\u6b63\u5728\u9519\u5931\u5927\u5e45\u51cf\u5c11\u5e94\u7528\u7a0b\u5e8f\u4f53\u79ef\u7684\u673a\u4f1a\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8981\u9009\u62e9\u5b8c\u5168\u88c1\u526a\uff0c\u60a8\u53ef\u4ee5\u5c06\u4ee5\u4e0b\u5185\u5bb9\u6dfb\u52a0\u5230 <code>.csproj<\/code> \u6587\u4ef6\u4e2d\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-xml\"><code class=\"language-xml\">&lt;PropertyGroup&gt;\r\n  &lt;TrimMode&gt;full&lt;\/TrimMode&gt;\r\n&lt;\/PropertyGroup&gt;<\/code><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ee5\u4e0b\u662f\u5b8c\u5168\u88c1\u526a\u7684\u5f71\u54cd\u793a\u4f8b\uff1a<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/03\/android-full-trimming.svg\"><img decoding=\"async\" class=\"alignnone wp-image-1049\" role=\"img\" src=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/03\/android-full-trimming.svg\" alt=\"\" width=\"799\" height=\"450\" \/><\/a><\/p>\n<p><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>\u6ce8\u610f<\/strong><\/p>MyPal \u662f\u4e00\u4e2a .NET MAUI \u793a\u4f8b\u5e94\u7528\u7a0b\u5e8f\uff0c\u7531\u4e8e\u5b83\u4f7f\u7528\u4e86\u591a\u4e2a\u5e38\u89c1\u7684 NuGet \u5305\uff0c\u56e0\u6b64\u975e\u5e38\u9002\u5408\u4f5c\u4e3a\u5bf9\u6bd4\u53c2\u8003\u3002\u00a0<\/div><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6709\u5173\u5b8c\u5168\u88c1\u526a\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u6211\u4eec\u7684<a href=\"https:\/\/learn.microsoft.com\/dotnet\/maui\/deployment\/trimming\">\u88c1\u526a .NET MAUI \u6587\u6863<\/a>\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>NativeAOT<\/b><\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">NativeAOT \u5efa\u7acb\u5728\u5b8c\u5168\u88c1\u526a\u7684\u57fa\u7840\u4e0a\uff0c\u65e2\u4f9d\u8d56\u4e8e\u4e0e\u88c1\u526a\u517c\u5bb9\u7684\u5e93\uff0c\u4e5f\u4f9d\u8d56\u4e8e\u4e0e AOT \u517c\u5bb9\u7684\u5e93\u3002NativeAOT \u662f\u4e00\u79cd\u65b0\u7684\u8fd0\u884c\u65f6\uff0c\u4e0e\u73b0\u6709\u8fd0\u884c\u65f6\u76f8\u6bd4\uff0c\u5b83\u53ef\u4ee5\u7f29\u77ed\u542f\u52a8\u65f6\u95f4\u5e76\u51cf\u5c0f\u5e94\u7528\u7a0b\u5e8f\u5927\u5c0f\u3002\u00a0<\/span><\/p>\n<p><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>\u6ce8\u610f<\/strong><\/p>NativeAOT \u5c1a\u672a\u652f\u6301 Android\uff0c\u4f46\u5728 iOS\u3001MacCatalyst \u548c Windows\u4e2d\u53ef\u7528\u3002\u00a0<\/div><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8981\u542f\u7528 NativeAOT:\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-xml\"><code class=\"language-xml\">&lt;PropertyGroup&gt;\r\n  &lt;IsAotCompatible&gt;true&lt;\/IsAotCompatible&gt;\r\n  &lt;PublishAot&gt;true&lt;\/PublishAot&gt;\r\n&lt;\/PropertyGroup&gt;<\/code><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ee5\u4e0b\u662f NativeAOT \u5bf9\u5e94\u7528\u7a0b\u5e8f\u4f53\u79ef\u5f71\u54cd\u7684\u793a\u4f8b\uff1a\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\" data-ccp-props=\"{}\"><a href=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/03\/nativeaot-filesize.svg\"><img decoding=\"async\" class=\"alignnone wp-image-1050\" role=\"img\" src=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/03\/nativeaot-filesize.svg\" alt=\"\" width=\"800\" height=\"450\" \/><\/a><\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ee5\u53ca\u542f\u52a8\u6027\u80fd\uff1a\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\" data-ccp-props=\"{}\"><a href=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/03\/nativeaot-startup.svg\"><img decoding=\"async\" class=\"alignnone wp-image-1051\" role=\"img\" src=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/03\/nativeaot-startup.svg\" alt=\"\" width=\"799\" height=\"450\" \/><\/a><\/span><\/p>\n<p data-ccp-border-top=\"0.6666666666666666px solid #000000\" data-ccp-padding-top=\"5.333333333333333px\"><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>\u6ce8\u610f<\/strong><\/p>\u4e0a\u8ff0\u56fe\u8868\u4e2d\u7684 macOS \u8fd0\u884c\u5728 <code>MacCatalyst<\/code> \u4e0a\uff0c\u8fd9\u662f .NET MAUI \u5e94\u7528\u5728 Mac \u64cd\u4f5c\u7cfb\u7edf\u4e0a\u7684\u9ed8\u8ba4\u8fd0\u884c\u65b9\u5f0f\u3002\u00a0<\/div><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6709\u5173\u6b64\u65b0\u652f\u6301\u7684\u8fd0\u884c\u65f6\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u6211\u4eec\u7684 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/maui\/deployment\/nativeaot\">NativeAOT \u90e8\u7f72\u6587\u6863<\/a>\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>NuGet\u5305\u4f5c\u8005<\/b><\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4f5c\u4e3a NuGet \u5305\u7684\u4f5c\u8005\uff0c\u60a8\u53ef\u80fd\u5e0c\u671b\u60a8\u7684\u8f6f\u4ef6\u5305\u80fd\u591f\u5728\u5b8c\u5168\u88c1\u526a\u6216 NativeAOT \u573a\u666f\u4e0b\u8fd0\u884c\u3002\u8fd9\u5bf9\u4e8e\u9762\u5411 .NET MAUI\u3001\u79fb\u52a8\u5e94\u7528\uff0c\u751a\u81f3\u662f\u81ea\u5305\u542b\u7684 ASP.NET \u5fae\u670d\u52a1\u5f00\u53d1\u8005\u6765\u8bf4\u975e\u5e38\u6709\u7528\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8981\u652f\u6301 NativeAOT\uff0c\u60a8\u9700\u8981\uff1a\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"4\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5c06\u7a0b\u5e8f\u96c6\u6807\u8bb0\u4e3a \u201ctrim-compatible\u201d \u548c \u201cAOT-compatible\u201d\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"4\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u542f\u7528 Roslyn \u5206\u6790\u5668\u4ee5\u68c0\u67e5\u88c1\u526a\u548c NativeAOT \u517c\u5bb9\u6027\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"4\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u89e3\u51b3\u6240\u6709\u8b66\u544a\u3002\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u9996\u5148\uff0c\u4fee\u6539\u60a8\u7684 <code>.csproj<\/code> \u6587\u4ef6\uff1a<\/span><\/p>\n<pre class=\"prettyprint language-xml\"><code class=\"language-xml\">&lt;PropertyGroup&gt;\r\n  &lt;IsTrimmable&gt;true&lt;\/IsTrimmable&gt;\r\n  &lt;IsAotCompatible&gt;true&lt;\/IsAotCompatible&gt;\r\n&lt;\/PropertyGroup&gt;<\/code><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8fd9\u4e9b\u5c5e\u6027\u5c06\u542f\u7528 Roslyn \u5206\u6790\u5668\uff0c\u5e76\u5728\u751f\u6210\u7684 .NET \u7a0b\u5e8f\u96c6\u4e2d\u5305\u542b <code>[assembly: AssemblyMetadata]<\/code> \u4fe1\u606f\u3002\u6839\u636e\u60a8\u7684\u5e93\u5bf9 System.Reflection \u7b49\u7279\u6027\u7684\u4f7f\u7528\u60c5\u51b5\uff0c\u60a8\u53ef\u80fd\u4f1a\u9047\u5230\u5c11\u91cf\uff0c\u4e5f\u6709\u53ef\u80fd\u662f\u5927\u91cf\u7684\u8b66\u544a\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/deploying\/trimming\/prepare-libraries-for-trimming\">\u6709\u5173\u51c6\u5907\u88c1\u526a\u5e93\u7684\u6587\u6863<\/a>\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><span style=\"font-size: 18pt;\"><b>XAML\u548c\u88c1\u526a<\/b><\/span>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6709\u65f6\uff0c\u5728\u60a8\u7684\u5e94\u7528\u4e2d\u4f7f\u7528 NativeAOT \u53ef\u4ee5\u50cf\u5728\u9879\u76ee\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u5c5e\u6027\u4e00\u6837\u7b80\u5355\u3002\u4f46\u662f\uff0c\u5bf9\u4e8e\u8bb8\u591a .NET MAUI \u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u80fd\u9700\u8981\u89e3\u51b3\u7684\u8b66\u544a\u4f1a\u6709\u5f88\u591a\u3002 NativeAOT \u7f16\u8bd1\u5668\u901a\u8fc7\u79fb\u9664\u4e0d\u5fc5\u8981\u7684\u4ee3\u7801\u548c\u5143\u6570\u636e\uff0c\u4f7f\u5e94\u7528\u66f4\u5c0f\u3001\u66f4\u5feb\u3002\u4e0d\u8fc7\uff0c\u8fd9\u9700\u8981\u4e86\u89e3\u54ea\u4e9b\u7c7b\u578b\u53ef\u4ee5\u88ab\u521b\u5efa\uff0c\u54ea\u4e9b\u65b9\u6cd5\u5728\u8fd0\u884c\u65f6\u53ef\u4ee5\u88ab\u8c03\u7528\uff0c\u54ea\u4e9b\u4e0d\u53ef\u4ee5\u3002\u5bf9\u4e8e\u5927\u91cf\u4f7f\u7528 System.Reflection \u7684\u4ee3\u7801\u6765\u8bf4\uff0c\u8fd9\u901a\u5e38\u662f\u96be\u4ee5\u5b9e\u73b0\u7684\u3002\u5728 .NET MAUI \u4e2d\uff0c\u6709\u4e24\u4e2a\u9886\u57df\u5c5e\u4e8e\u8fd9\u4e00\u7c7b\uff1aXAML \u548c\u6570\u636e\u7ed1\u5b9a\u3002\u00a0<\/span><\/p>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 14pt;\"><b>\u7f16\u8bd1XAML<\/b>\u00a0<\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u8fd0\u884c\u65f6\u52a0\u8f7d XAML \u63d0\u4f9b\u4e86\u7075\u6d3b\u6027\u5e76\u652f\u6301 XAML \u70ed\u91cd\u8f7d\u7b49\u529f\u80fd\u3002XAML \u53ef\u4ee5\u5b9e\u4f8b\u5316\u6574\u4e2a\u5e94\u7528\u7a0b\u5e8f\u3001.NET MAUI SDK \u548c\u5f15\u7528\u7684 NuGet \u5305\u4e2d\u7684\u4efb\u4f55\u7c7b\u3002XAML \u8fd8\u53ef\u4ee5\u4e3a\u4efb\u4f55\u5c5e\u6027\u8bbe\u7f6e\u503c\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ece\u6982\u5ff5\u4e0a\u8bb2\uff0c\u5728\u8fd0\u884c\u65f6\u52a0\u8f7d XAML \u5e03\u5c40\u9700\u8981\uff1a\u00a0<\/span><\/p>\n<ol>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u89e3\u6790 XML \u6587\u6863\u3002\u00a0<\/span><\/li>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4f7f\u7528 <code>Type.GetType(xmlElementName)<\/code> \u6839\u636e XML \u5143\u7d20\u540d\u79f0\u67e5\u627e\u63a7\u4ef6\u7c7b\u578b\u3002\u00a0<\/span><\/li>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4f7f\u7528 <code>Activator.CreateInstance(controlType)<\/code> \u521b\u5efa\u63a7\u4ef6\u7684\u65b0\u5b9e\u4f8b\u3002\u00a0<\/span><\/li>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5c06\u539f\u59cb\u7684\u5b57\u7b26\u4e32 XML \u5c5e\u6027\u503c\u8f6c\u6362\u4e3a\u76ee\u6807\u5c5e\u6027\u7684\u7c7b\u578b\u3002\u00a0<\/span><\/li>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6839\u636e XML \u5c5e\u6027\u7684\u540d\u79f0\u8bbe\u7f6e\u5c5e\u6027\u3002 <\/span><\/li>\n<\/ol>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8fd9\u4e2a\u8fc7\u7a0b\u4e0d\u4ec5\u7f13\u6162\uff0c\u800c\u4e14\u5bf9 NativeAOT \u6765\u8bf4\u4e5f\u662f\u4e00\u4e2a\u5de8\u5927\u7684\u6311\u6218\u3002\u4f8b\u5982\uff0c\u4fee\u526a\u5668\u4e0d\u77e5\u9053\u4f7f\u7528 <code>Type.GetType<\/code> \u65b9\u6cd5\u4f1a\u67e5\u627e\u54ea\u4e9b\u7c7b\u578b\u3002\u8fd9\u610f\u5473\u7740\u7f16\u8bd1\u5668\u8981\u4e48\u5fc5\u987b\u5728\u6700\u7ec8\u5e94\u7528\u4e2d\u4fdd\u7559\u6574\u4e2a .NET MAUI SDK \u548c\u6240\u6709 NuGet \u5305\u7684\u6240\u6709\u7c7b\uff0c\u8981\u4e48\u8be5\u65b9\u6cd5\u53ef\u80fd\u65e0\u6cd5\u627e\u5230 XML \u8f93\u5165\u4e2d\u58f0\u660e\u7684\u7c7b\u578b\uff0c\u4ece\u800c\u5bfc\u81f4\u8fd0\u884c\u65f6\u5931\u8d25\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5e78\u8fd0\u7684\u662f\uff0c.NET MAUI \u63d0\u4f9b\u4e86\u4e00\u4e2a\u89e3\u51b3\u65b9\u6848\u2014\u2014<a href=\"https:\/\/learn.microsoft.com\/dotnet\/maui\/xaml\/xamlc\">XAML \u7f16\u8bd1<\/a>\u3002\u8fd9\u4f1a\u5728\u6784\u5efa\u65f6\u5c06 XAML \u8f6c\u6362\u4e3a InitializeComponent() \u65b9\u6cd5\u7684\u5b9e\u9645\u4ee3\u7801\u3002\u751f\u6210\u4ee3\u7801\u540e\uff0cNativeAOT \u7f16\u8bd1\u5668\u5c06\u62e5\u6709\u88c1\u526a\u5e94\u7528\u7a0b\u5e8f\u6240\u9700\u7684\u6240\u6709\u4fe1\u606f\u3002<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728 .NET 9 \u4e2d\uff0c\u6211\u4eec\u5b9e\u73b0\u4e86\u7f16\u8bd1\u5668\u5728\u65e9\u671f\u7248\u672c\u4e2d\u65e0\u6cd5\u5904\u7406\u7684\u6700\u540e\u5269\u4f59\u7684 XAML \u529f\u80fd\uff0c\u5c24\u5176\u662f\u7f16\u8bd1\u7ed1\u5b9a\u3002\u6700\u540e\uff0c\u5982\u679c\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u4f9d\u8d56\u4e8e\u5728\u8fd0\u884c\u65f6\u52a0\u8f7d XAML\uff0c\u5219 NativeAOT \u53ef\u80fd\u4e0d\u9002\u5408\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u00a0<\/span><\/p>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 14pt;\"><b>\u7f16\u8bd1\u7ed1\u5b9a<\/b>\u00a0<\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u7f16\u8bd1\u7ed1\u5b9a\u5c06\u6e90\u5c5e\u6027\u4e0e\u76ee\u6807\u5c5e\u6027\u5173\u8054\u5728\u4e00\u8d77\u3002\u5f53\u6e90\u5c5e\u6027\u53d1\u751f\u53d8\u5316\u65f6\uff0c\u503c\u4f1a\u81ea\u52a8\u4f20\u64ad\u5230\u76ee\u6807\u5c5e\u6027\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">.NET MAUI \u4e2d\u7684\u7ed1\u5b9a\u4f7f\u7528\u5b57\u7b26\u4e32 \u201c\u8def\u5f84\uff08path\u201d\u5b9a\u4e49\u3002\u6b64\u8def\u5f84\u7c7b\u4f3c\u4e8e\u7528\u4e8e\u8bbf\u95ee\u5c5e\u6027\u548c\u7d22\u5f15\u5668\u7684 C# \u8868\u8fbe\u5f0f\u3002\u5f53\u5c06\u7ed1\u5b9a\u5e94\u7528\u4e8e\u6e90\u5bf9\u8c61\u65f6\uff0c.NET MAUI \u4f7f\u7528 System.Reflection \u9075\u5faa\u8def\u5f84\u6765\u8bbf\u95ee\u6240\u9700\u7684\u6e90\u5c5e\u6027\u3002\u8fd9\u4e0e\u5728\u8fd0\u884c\u65f6\u52a0\u8f7d XAML \u5b58\u5728\u76f8\u540c\u7684\u95ee\u9898\uff0c\u56e0\u4e3a\u88c1\u526a\u5668\u4e0d\u77e5\u9053\u54ea\u4e9b\u5c5e\u6027\u53ef\u4ee5\u901a\u8fc7\u53cd\u5c04\u8bbf\u95ee\uff0c\u56e0\u6b64\u4e5f\u5c31\u4e0d\u77e5\u9053\u53ef\u4ee5\u5b89\u5168\u5730\u4ece\u6700\u7ec8\u5e94\u7528\u7a0b\u5e8f\u4e2d\u88c1\u526a\u54ea\u4e9b\u5c5e\u6027\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5f53\u6211\u4eec\u901a\u8fc7 <code>x:DataType<\/code> \u5c5e\u6027\u5728\u6784\u5efa\u4e2d\u660e\u786e\u6e90\u5bf9\u8c61\u7684\u7c7b\u578b\u65f6\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5c06\u7ed1\u5b9a\u8def\u5f84\u7f16\u8bd1\u4e3a\u4e00\u4e2a\u7b80\u5355\u7684 getter \u65b9\u6cd5\uff08\u4ee5\u53ca\u53cc\u5411\u7ed1\u5b9a\u7684 setter \u65b9\u6cd5\uff09\u3002\u7f16\u8bd1\u5668\u8fd8\u4f1a\u786e\u4fdd\u7ed1\u5b9a\u80fd\u591f\u76d1\u542c\u6240\u6709\u5b9e\u73b0 <code>INotifyPropertyChanged<\/code> \u63a5\u53e3\u7684\u5c5e\u6027\u53d8\u5316\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728 <\/span><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">.NET 8 \u53ca\u66f4\u65e9\u7248\u672c\u4e2d\uff0cXAML \u7f16\u8bd1\u5668\u5df2\u7ecf\u53ef\u4ee5\u7f16\u8bd1\u5927\u591a\u6570\u7ed1\u5b9a\u3002\u5728 .NET 9 \u4e2d\uff0c\u6211\u4eec\u786e\u4fdd\u53ef\u4ee5\u7f16\u8bd1 XAML \u4ee3\u7801\u4e2d\u7684\u4efb\u4f55\u7ed1\u5b9a\u3002\u6709\u5173\u6b64\u529f\u80fd\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605<a href=\"https:\/\/learn.microsoft.com\/dotnet\/maui\/fundamentals\/data-binding\/compiled-bindings\">\u5df2\u7f16\u8bd1\u7684\u7ed1\u5b9a\u6587\u6863<\/a>\u3002\u00a0<\/span><\/p>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 14pt;\"><b>C#\u4e2d\u7684\u7f16\u8bd1\u7ed1\u5b9a<\/b><\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728 .NET 8 \u53ca\u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u5728 C# \u4ee3\u7801\u4e2d\u5b9a\u4e49\u6570\u636e\u7ed1\u5b9a\u7684\u552f\u4e00\u652f\u6301\u65b9\u5f0f\u662f\u4f7f\u7528\u57fa\u4e8e\u5b57\u7b26\u4e32\u7684\u8def\u5f84\u3002 \u5728 .NET 9 \u4e2d\uff0c\u6211\u4eec\u5f15\u5165\u4e86\u4e00\u79cd\u65b0\u7684 API\uff0c\u5141\u8bb8\u4f7f\u7528\u6e90\u751f\u6210\u5668\u6765\u7f16\u8bd1\u6570\u636e\u7ed1\u5b9a\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-cs language-csharp\"><code class=\"language-cs language-csharp\">\/\/ .NET 8 and earlier\r\nmyLabel.SetBinding(Label.TextProperty, \"Text\");\r\n\r\n\/\/ .NET 9\r\nmyLabel.SetBinding(Label.TextProperty, static (Entry nameEntry) =&gt; nameEntry.Text);<\/code><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>Binding.Create()<\/code> \u65b9\u6cd5\u4e5f\u662f\u4e00\u4e2a\u53ef\u9009\u65b9\u6848\uff0c\u9002\u7528\u4e8e\u9700\u8981\u4fdd\u5b58\u7ed1\u5b9a\u5b9e\u4f8b\u4ee5\u4f9b\u540e\u7eed\u4f7f\u7528\u7684\u60c5\u51b5\uff1a<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">var nameBinding = Binding.Create(static (Entry nameEntry) =&gt; nameEntry.Text);<\/code><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">.NET MAUI \u7684\u6e90\u751f\u6210\u5668\u5c06\u4ee5\u4e0e XAML \u7f16\u8bd1\u5668\u76f8\u540c\u7684\u65b9\u5f0f\u7f16\u8bd1\u7ed1\u5b9a\u3002\u8fd9\u6837\uff0cNativeAOT \u7f16\u8bd1\u5668\u5c31\u53ef\u4ee5\u5bf9\u7ed1\u5b9a\u8fdb\u884c\u5168\u9762\u5206\u6790\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5373\u4f7f\u60a8\u4e0d\u6253\u7b97\u5c06\u5e94\u7528\u7a0b\u5e8f\u8fc1\u79fb\u5230 NativeAOT\uff0c\u7f16\u8bd1\u540e\u7684\u7ed1\u5b9a\u4e5f\u80fd\u63d0\u9ad8\u7ed1\u5b9a\u7684\u6574\u4f53\u6027\u80fd\u3002\u4e3a\u4e86\u5c55\u793a\u5176\u4e2d\u7684\u5dee\u5f02\uff0c\u8ba9\u6211\u4eec\u4f7f\u7528 <code>BenchmarkDotNet<\/code> \u6765\u6d4b\u91cf\u5728 Android \u4e0a\u4f7f\u7528 Mono \u8fd0\u884c\u65f6\u8c03\u7528 <code>SetBinding()<\/code> \u7684\u6027\u80fd\u5dee\u5f02\u3002\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-cs language-csharp\"><code class=\"language-cs language-csharp\">\/\/ dotnet build -c Release -t:Run -f net9.0-android\r\n\r\npublic class SetBindingBenchmark\r\n{\r\n    private readonly ContactInformation _contact = new ContactInformation(new FullName(\"John\"));\r\n    private readonly Label _label = new();\r\n\r\n    [GlobalSetup]\r\n    public void Setup()\r\n    {\r\n        DispatcherProvider.SetCurrent(new MockDispatcherProvider());\r\n        _label.BindingContext = _contact;\r\n    }\r\n\r\n    [Benchmark(Baseline = true)]\r\n    public void Classic_SetBinding()\r\n    {\r\n        _label.SetBinding(Label.TextProperty, \"FullName.FirstName\");\r\n    }\r\n\r\n    [Benchmark]\r\n    public void Compiled_SetBinding()\r\n    {\r\n        _label.SetBinding(Label.TextProperty, static (ContactInformation contact) =&gt; contact.FullName?.FirstName);\r\n    }\r\n\r\n    [IterationCleanup]\r\n    public void Cleanup()\r\n    {\r\n        _label.RemoveBinding(Label.TextProperty);\r\n    }\r\n}<\/code><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5f53\u6211\u5728\u4e09\u661f Galaxy S23 \u4e0a\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\u65f6\uff0c\u5f97\u5230\u4e86\u4ee5\u4e0b\u7ed3\u679c\uff1a\u00a0<\/span><\/p>\n<table data-tablestyle=\"MsoTableGrid\" data-tablelook=\"1696\" aria-rowcount=\"3\">\n<tbody>\n<tr aria-rowindex=\"1\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u65b9\u6cd5\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5e73\u5747\u65f6\u95f4\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u504f\u5dee\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6807\u51c6\u504f\u5dee\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6bd4\u7387\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6bd4\u7387\u6807\u51c6\u5dee\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"2\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Classic_SetBinding\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">67.81 us\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">1.338 us\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">1.787 us\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">1.00\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">0.04\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"3\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Compiled_SetBinding\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">30.61 \u00b5s\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">0.629 us\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">1.182 us\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">0.45\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">0.02\u00a0<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u7ecf\u5178\u7ed1\u5b9a\u9996\u5148\u9700\u8981\u89e3\u6790\u57fa\u4e8e\u5b57\u7b26\u4e32\u7684\u8def\u5f84\uff0c\u7136\u540e\u4f7f\u7528 System.Reflection \u83b7\u53d6\u6e90\u7684\u5f53\u524d\u503c\u3002\u800c\u4f7f\u7528\u7f16\u8bd1\u7ed1\u5b9a\u540e\uff0c\u6bcf\u6b21\u5bf9\u6e90\u5c5e\u6027\u7684\u66f4\u65b0\u4e5f\u4f1a\u66f4\u5feb\u3002\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-cs language-csharp\"><code class=\"language-cs language-csharp\">\/\/ dotnet build -c Release -t:Run -f net9.0-android\r\n\r\npublic class UpdateValueTwoLevels\r\n{\r\n    ContactInformation _contact = new ContactInformation(new FullName(\"John\"));\r\n    Label _label = new();\r\n\r\n    [GlobalSetup]\r\n    public void Setup()\r\n    {\r\n        DispatcherProvider.SetCurrent(new MockDispatcherProvider());\r\n        _label.BindingContext = _contact;\r\n    }\r\n\r\n    [IterationSetup(Target = nameof(Classic_UpdateWhenSourceChanges))]\r\n    public void SetupClassicBinding()\r\n    {\r\n        _label.SetBinding(Label.TextProperty, \"FullName.FirstName\");\r\n    }\r\n\r\n    [IterationSetup(Target = nameof(Compiled_UpdateWhenSourceChanges))]\r\n    public void SetupCompiledBinding()\r\n    {\r\n        _label.SetBinding(Label.TextProperty, static (ContactInformation contact) =&gt; contact.FullName?.FirstName);\r\n    }\r\n\r\n    [Benchmark(Baseline = true)]\r\n    public void Classic_UpdateWhenSourceChanges()\r\n    {\r\n        _contact.FullName.FirstName = \"Jane\";\r\n    }\r\n\r\n    [Benchmark]\r\n    public void Compiled_UpdateWhenSourceChanges()\r\n    {\r\n        _contact.FullName.FirstName = \"Jane\";\r\n    }\r\n\r\n    [IterationCleanup]\r\n    public void Reset()\r\n    {\r\n        _label.Text = \"John\";\r\n        _contact.FullName.FirstName = \"John\";\r\n        _label.RemoveBinding(Label.TextProperty);\r\n    }\r\n}<\/code><\/pre>\n<table data-tablestyle=\"MsoTableGrid\" data-tablelook=\"1696\" aria-rowcount=\"3\">\n<tbody>\n<tr aria-rowindex=\"1\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u65b9\u6cd5\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5e73\u5747\u65f6\u95f4\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u504f\u5dee\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6807\u51c6\u504f\u5dee\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6bd4\u7387\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6bd4\u7387\u6807\u51c6\u5dee\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"2\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Classic_UpdateWhenSourceChanges\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">46.06 us\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">0.934 us\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">1.369 us\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">1.00\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">0.04\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"3\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Compiled_UpdateWhenSourceChanges\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">30.85 \u00b5s\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">0.634 us\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">1.295 us\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">0.67\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">0.03\u00a0<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5355\u4e2a\u7ed1\u5b9a\u7684\u6027\u80fd\u5dee\u5f02\u5e76\u4e0d\u5927\uff0c\u4f46\u7d2f\u79ef\u8d77\u6765\u5c31\u5f88\u660e\u663e\u4e86\u3002\u5728\u5305\u542b\u5927\u91cf\u7ed1\u5b9a\u7684\u590d\u6742\u9875\u9762\u4e0a\uff0c\u6216\u8005\u5728\u6eda\u52a8 <code>CollectionView<\/code> \u6216 <code>ListView<\/code> \u7b49\u5217\u8868\u65f6\uff0c\u8fd9\u79cd\u5dee\u5f02\u53ef\u80fd\u4f1a\u66f4\u52a0\u660e\u663e\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/github.com\/simonrozsival\/maui9-bindings-benchmark\">\u4e0a\u8ff0\u57fa\u51c6\u6d4b\u8bd5\u7684\u5b8c\u6574\u6e90\u4ee3\u7801<\/a>\u53ef\u5728 GitHub \u4e0a\u627e\u5230\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>.NET MAUI \u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u5206\u6790<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5c06 <code>dotnet-trace<\/code> \u9644\u52a0\u5230 .NET MAUI \u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u83b7\u53d6 <code>.nettrace<\/code> \u548c <code>.speedscope<\/code> \u7b49\u683c\u5f0f\u7684\u6027\u80fd\u5206\u6790\u4fe1\u606f\u3002\u8fd9\u4e9b\u4fe1\u606f\u53ef\u4e3a\u60a8\u63d0\u4f9b\u6709\u5173\u5e94\u7528\u7a0b\u5e8f\u4e2d\u6bcf\u4e2a\u65b9\u6cd5\u6240\u7528\u65f6\u95f4\u7684 CPU \u91c7\u6837\u4fe1\u606f\u3002\u8fd9\u5bf9\u4e8e\u67e5\u627e\u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u65f6\u6216\u6574\u4f53\u6027\u80fd\u4e2d\u7684\u8017\u65f6\u70b9\u975e\u5e38\u6709\u7528\u3002\u540c\u6837\uff0c<code>dotnet-gcdump<\/code> \u53ef\u4ee5\u83b7\u53d6\u5e94\u7528\u7a0b\u5e8f\u7684\u5185\u5b58\u5feb\u7167\uff0c\u663e\u793a\u5185\u5b58\u4e2d\u6240\u6709\u6258\u7ba1\u7684 C# \u5bf9\u8c61\u3002\u6b64\u5916\uff0c<code>dotnet-dsrouter<\/code> \u662f\u5c06 <code>dotnet-trace<\/code> \u8fde\u63a5\u5230\u8fdc\u7a0b\u8bbe\u5907\u6240\u5fc5\u9700\u7684\uff0c\u4f46\u5bf9\u4e8e\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\u5e76\u4e0d\u9700\u8981\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u5f0f\u5b89\u88c5\u8fd9\u4e9b\u5de5\u5177\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">$ dotnet tool install -g dotnet-trace\r\nYou can invoke the tool using the following command: dotnet-trace\r\nTool 'dotnet-trace' was successfully installed.\r\n$ dotnet tool install -g dotnet-dsrouter\r\nYou can invoke the tool using the following command: dotnet-dsrouter\r\nTool 'dotnet-dsrouter' was successfully installed.\r\n$ dotnet tool install -g dotnet-gcdump\r\nYou can invoke the tool using the following command: dotnet-gcdump\r\nTool 'dotnet-gcdump' was successfully installed.<\/code><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ece\u8fd9\u91cc\u5f00\u59cb\uff0c\u4e0d\u540c\u5e73\u53f0\u7684\u64cd\u4f5c\u7565\u6709\u4e0d\u540c\uff0c\u4f46\u603b\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a\u00a0<\/span><\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ee5\u53d1\u5e03 (Release) \u6a21\u5f0f\u6784\u5efa\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u5bf9\u4e8e\u5b89\u5353\u7aef\uff0c\u9700\u8981\u5728 <code>.csproj<\/code> \u6587\u4ef6\u4e2d\u542f\u7528 <code>&lt;AndroidEnableProfiler&gt;true&lt;\/AndroidEnableProfiler&gt;<\/code>\uff0c\u4ee5\u4fbf\u5c06\u5fc5\u8981\u7684 Mono \u8bca\u65ad\u7ec4\u4ef6\u5305\u542b\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u3002 <\/span><\/li>\n<li>\u5982\u679c\u8981\u5bf9\u79fb\u52a8\u7aef\u8fdb\u884c\u6027\u80fd\u5206\u6790\uff0c\u5728\u5f00\u53d1\u673a\u5668\u4e0a\u8fd0\u884c <code style=\"font-size: 12pt;\">dotnet-dsrouter android<\/code><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\uff08\u6216 <\/span><code style=\"font-size: 12pt;\">dotnet-dsrouter ios<\/code><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"> \u7b49\uff09\u3002 <\/span><\/li>\n<li>\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4f7f\u5e94\u7528\u7a0b\u5e8f\u80fd\u591f\u8fde\u63a5\u5230\u6027\u80fd\u5206\u6790\u5668\u3002\u4f8b\u5982\uff0c\u5728 Android \u4e0a:\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">$ adb reverse tcp:9000 tcp:9001\r\n# no output\r\n$ adb shell setprop debug.mono.profile '127.0.0.1:9000,nosuspend,connect'\r\n# no output<\/code><\/pre>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<ol>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8fd0\u884c\u7a0b\u5e8f\u3002\u00a0<\/span><\/li>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4f7f\u7528 <code>dotnet-dsrouter<\/code> \u7684 PID\uff0c\u5c06 <code>dotnet-trace<\/code>\uff08\u6216 <code>dotnet-gcdump<\/code>\uff09\u9644\u52a0\u5230\u5e94\u7528\u7a0b\u5e8f\uff1a\u00a0<\/span>\n<pre class=\"prettyprint language-default\" style=\"padding-left: 40px;\"><code class=\"language-default\">$ dotnet-trace ps\r\n38604  dotnet-dsrouter  ~\/.dotnet\/tools\/dotnet-dsrouter.exe  ~\/.dotnet\/tools\/dotnet-dsrouter.exe android\r\n\r\n$ dotnet-trace collect -p 38604 --format speedscope\r\nNo profile or providers specified, defaulting to trace profile 'cpu-sampling'\r\n\r\nProvider Name                           Keywords            Level               Enabled By\r\nMicrosoft-DotNETCore-SampleProfiler     0x0000F00000000000  Informational(4)    --profile \r\nMicrosoft-Windows-DotNETRuntime         0x00000014C14FCCBD  Informational(4)    --profile \r\n\r\nWaiting for connection on \/tmp\/maui-app\r\nStart an application with the following environment variable: DOTNET_DiagnosticPorts=\/tmp\/maui-app<\/code><\/pre>\n<\/li>\n<\/ol>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5bf9\u4e8e iOS\u3001macOS \u548c MacCatalyst\uff0c\u8bf7\u53c2\u9605 <a href=\"https:\/\/github.com\/dotnet\/maui\/wiki\/Profiling-.NET-MAUI-Apps#ios-mac-etc\">iOS \u6027\u80fd\u5206\u6790 Wiki \u9875\u9762<\/a>\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002\u00a0<\/span><\/p>\n<p data-ccp-border-bottom=\"0.6666666666666666px solid #000000\" data-ccp-padding-bottom=\"5.333333333333333px\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>\u6ce8\u610f<\/strong><\/p>\u5bf9\u4e8e Windows \u5e94\u7528\u7a0b\u5e8f\uff0c\u60a8\u53ef\u4ee5\u8003\u8651\u4f7f\u7528 Visual Studio \u5185\u7f6e\u7684\u6027\u80fd\u5206\u6790\u5de5\u5177\uff0c\u4f46\u4f7f\u7528 dotnet-trace collect &#8212; C:\\path\\to\\an\\executable.exe \u4e5f\u53ef\u4ee5\u4f5c\u4e3a\u53e6\u4e00\u79cd\u9009\u62e9\u3002\u00a0<\/div><\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u73b0\u5728\uff0c\u60a8\u5df2\u7ecf\u6536\u96c6\u4e86\u5305\u542b\u6027\u80fd\u4fe1\u606f\u7684\u6587\u4ef6\uff0c\u63a5\u7740\u662f\u6253\u5f00\u5b83\u4eec\u6765\u67e5\u770b\u6570\u636e\uff1a\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>dotnet-trace<\/code> \u9ed8\u8ba4\u751f\u6210 <code>.nettrace<\/code> \u6587\u4ef6\uff0c\u53ef\u4ee5\u5728 <a href=\"https:\/\/github.com\/microsoft\/perfview\">PerfView<\/a> \u6216 Visual Studio \u4e2d\u6253\u5f00\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4f7f\u7528 <code>dotnet-trace collect --format speedscope<\/code> \u751f\u6210\u7684 <code>.speedscope<\/code> \u6587\u4ef6\uff0c\u53ef\u4ee5\u5728 <a href=\"https:\/\/www.speedscope.app\/\">Speedscope Web \u5e94\u7528<\/a>\u4e2d\u6253\u5f00\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>dotnet-gcdump<\/code> \u751f\u6210 <code>.gcdump<\/code> \u6587\u4ef6\uff0c\u53ef\u4ee5\u5728 <a href=\"https:\/\/github.com\/microsoft\/perfview\">PerfView<\/a> \u6216 Visual Studio \u4e2d\u6253\u5f00\u3002\u4f46\u76ee\u524d macOS \u4e0a\u5c1a\u65e0\u8f83\u597d\u7684\u5de5\u5177\u6765\u67e5\u770b\u8fd9\u4e9b\u6587\u4ef6\u3002\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u672a\u6765\uff0c\u6211\u4eec\u5e0c\u671b\u5728\u540e\u7eed\u7684 .NET \u8bca\u65ad\u5de5\u5177 \u548c Visual Studio \u7248\u672c\u4e2d\uff0c\u4f7f .NET MAUI \u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u5206\u6790\u66f4\u52a0\u4fbf\u6377\u3002\u00a0<\/span><\/p>\n<p data-ccp-border-bottom=\"0.6666666666666666px solid #000000\" data-ccp-padding-bottom=\"5.333333333333333px\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>\u6ce8\u610f<\/strong><\/p>NativeAOT \u8fd0\u884c\u65f6\u4e0d\u652f\u6301 <code>dotnet-trace<\/code> \u548c\u6027\u80fd\u5206\u6790\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u53d7\u652f\u6301\u7684\u8fd0\u884c\u65f6\u8fdb\u884c\u5206\u6790\uff0c\u6216\u8005\u4f7f\u7528\u4f8b\u5982 Xcode\u2019s Instruments \u7b49\u539f\u751f\u6027\u80fd\u5206\u6790\u5de5\u5177\u3002\u00a0<\/div><\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u603b\u7ed3<\/b><\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">.NET 9 \u901a\u8fc7\u5b8c\u5168\u88c1\u526a\u548c NativeAOT \u4e3a .NET MAUI \u5e94\u7528\u7a0b\u5e8f\u5e26\u6765\u4e86\u6027\u80fd\u63d0\u5347\u3002\u8fd9\u4e9b\u529f\u80fd\u53ef\u4ee5\u51cf\u5c11\u5e94\u7528\u7a0b\u5e8f\u4f53\u79ef\u5e76\u63d0\u5347\u542f\u52a8\u901f\u5ea6\uff0c\u4ece\u800c\u8ba9\u5f00\u53d1\u8005\u6784\u5efa\u66f4\u9ad8\u6548\u3001\u66f4\u6d41\u7545\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u901a\u8fc7\u4f7f\u7528 dotnet-trace \u548c dotnet-gcdump \u7b49\u5de5\u5177\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u6df1\u5165\u5206\u6790\u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8981\u5168\u9762\u4e86\u89e3 .NET MAUI \u7684\u88c1\u526a\u548c NativeAOT\uff0c\u8bf7\u53c2\u9605\u6709\u5173\u8be5\u4e3b\u9898\u7684 <a href=\"https:\/\/youtu.be\/dcUN7c2w-Rg\">.NET Conf 2024 \u4f1a\u8bae<\/a>\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u7ffb\u8bd1\u81ea Jonathan \u548c\u00a0Simon \u7684 .NET MAUI Performance Features in .NET 9 .NET \u591a\u5e73\u53f0\u5e94\u7528 UI (.NET MAUI) \u968f\u7740\u5404\u4e2a\u7248\u672c\u7684\u53d1\u5e03\u800c\u4e0d\u65ad\u53d1\u5c55\uff0c\u4e0e\u6b64\u540c\u65f6\uff0c.NET 9 \u91cd\u70b9\u5f15\u5165\u4e86\u88c1\u526a\u529f\u80fd\u548c\u4e00\u4e2a\u65b0\u7684\u53d7\u652f\u6301\u8fd0\u884c\u65f6\uff1aNativeAOT\u3002\u8fd9\u4e9b\u529f\u80fd\u53ef\u4ee5\u5e2e\u52a9\u60a8\u51cf\u5c11\u5e94\u7528\u7a0b\u5e8f\u5927\u5c0f\u3001\u63d0\u9ad8\u542f\u52a8\u901f\u5ea6\uff0c\u5e76\u786e\u4fdd\u5e94\u7528\u7a0b\u5e8f\u5728\u5404\u4e2a\u5e73\u53f0\u4e0a\u6d41\u7545\u8fd0\u884c\u3002\u65e0\u8bba\u662f\u5e0c\u671b\u4f18\u5316 .NET MAUI \u5e94\u7528\u7684\u5f00\u53d1\u8005\uff0c\u8fd8\u662f NuGet \u5305\u7684\u4f5c\u8005\uff0c\u90fd\u53ef\u4ee5\u5728 .NET 9 \u4e2d\u4f7f\u7528\u8fd9\u4e9b\u529f\u80fd\u3002 \u6211\u4eec\u8fd8\u5c06\u5411\u5f00\u53d1\u4eba\u5458\u4ecb\u7ecd\u53ef\u7528\u4e8e\u6d4b\u91cf .NET MAUI \u5e94\u7528\u7a0b\u5e8f\u6027\u80fd\u7684\u9009\u9879\u3002CPU \u91c7\u6837\u548c\u5185\u5b58\u5feb\u7167\u53ef\u5206\u522b\u901a\u8fc7 dotnet-trace \u548c dotnet-gcdump \u83b7\u5f97\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u60a8\u6df1\u5165\u4e86\u89e3\u5e94\u7528\u7a0b\u5e8f\u3001NuGet \u5305\u7684\u6027\u80fd\u95ee\u9898\uff0c\u751a\u81f3\u662f\u6211\u4eec\u9700\u8981\u5173\u6ce8\u7684 .NET MAUI \u95ee\u9898\u3002\u00a0 \u80cc\u666f \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c iOS \u548c Android \u4e0a\u7684 .NET MAUI \u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u4ee5\u4e0b\u8bbe\u7f6e\uff1a\u00a0 \u201c\u81ea\u5305\u542b\u201d: \u610f\u5473\u7740\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5305\u542b BCL \u548c\u8fd0\u884c\u65f6\u7684\u526f\u672c\u3002\u00a0 \u90e8\u5206\u88c1\u526a\uff08TrimMode=partial\uff09\uff0c\u610f\u5473\u7740\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u4fee\u526a\u5e94\u7528\u7a0b\u5e8f\u6216 NuGet [&hellip;]<\/p>\n","protected":false},"author":177361,"featured_media":1053,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[59,1,84,63,86,85],"tags":[52,5],"class_list":["post-1046","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-net","category-dotnet-ch","category-net-maui","category-c","category-performance","category-xaml","tag-net-9","tag-net-maui"],"acf":[],"blog_post_summary":"<p>\u672c\u6587\u7ffb\u8bd1\u81ea Jonathan \u548c\u00a0Simon \u7684 .NET MAUI Performance Features in .NET 9 .NET \u591a\u5e73\u53f0\u5e94\u7528 UI (.NET MAUI) \u968f\u7740\u5404\u4e2a\u7248\u672c\u7684\u53d1\u5e03\u800c\u4e0d\u65ad\u53d1\u5c55\uff0c\u4e0e\u6b64\u540c\u65f6\uff0c.NET 9 \u91cd\u70b9\u5f15\u5165\u4e86\u88c1\u526a\u529f\u80fd\u548c\u4e00\u4e2a\u65b0\u7684\u53d7\u652f\u6301\u8fd0\u884c\u65f6\uff1aNativeAOT\u3002\u8fd9\u4e9b\u529f\u80fd\u53ef\u4ee5\u5e2e\u52a9\u60a8\u51cf\u5c11\u5e94\u7528\u7a0b\u5e8f\u5927\u5c0f\u3001\u63d0\u9ad8\u542f\u52a8\u901f\u5ea6\uff0c\u5e76\u786e\u4fdd\u5e94\u7528\u7a0b\u5e8f\u5728\u5404\u4e2a\u5e73\u53f0\u4e0a\u6d41\u7545\u8fd0\u884c\u3002\u65e0\u8bba\u662f\u5e0c\u671b\u4f18\u5316 .NET MAUI \u5e94\u7528\u7684\u5f00\u53d1\u8005\uff0c\u8fd8\u662f NuGet \u5305\u7684\u4f5c\u8005\uff0c\u90fd\u53ef\u4ee5\u5728 .NET 9 \u4e2d\u4f7f\u7528\u8fd9\u4e9b\u529f\u80fd\u3002 \u6211\u4eec\u8fd8\u5c06\u5411\u5f00\u53d1\u4eba\u5458\u4ecb\u7ecd\u53ef\u7528\u4e8e\u6d4b\u91cf .NET MAUI \u5e94\u7528\u7a0b\u5e8f\u6027\u80fd\u7684\u9009\u9879\u3002CPU \u91c7\u6837\u548c\u5185\u5b58\u5feb\u7167\u53ef\u5206\u522b\u901a\u8fc7 dotnet-trace \u548c dotnet-gcdump \u83b7\u5f97\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u60a8\u6df1\u5165\u4e86\u89e3\u5e94\u7528\u7a0b\u5e8f\u3001NuGet \u5305\u7684\u6027\u80fd\u95ee\u9898\uff0c\u751a\u81f3\u662f\u6211\u4eec\u9700\u8981\u5173\u6ce8\u7684 .NET MAUI \u95ee\u9898\u3002\u00a0 \u80cc\u666f \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c iOS \u548c Android \u4e0a\u7684 .NET MAUI \u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u4ee5\u4e0b\u8bbe\u7f6e\uff1a\u00a0 \u201c\u81ea\u5305\u542b\u201d: \u610f\u5473\u7740\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5305\u542b BCL \u548c\u8fd0\u884c\u65f6\u7684\u526f\u672c\u3002\u00a0 \u90e8\u5206\u88c1\u526a\uff08TrimMode=partial\uff09\uff0c\u610f\u5473\u7740\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u4fee\u526a\u5e94\u7528\u7a0b\u5e8f\u6216 NuGet [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts\/1046","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/users\/177361"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/comments?post=1046"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts\/1046\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/media\/1053"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/media?parent=1046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/categories?post=1046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/tags?post=1046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}