Skip to main content

dotnet-10

Provides up-to-date knowledge about .NET 10 and C# 14 for WPF application development. Use this skill when developing WPF apps targeting .NET 10, or when asked about .NET 10 / C# 14 features.

معلومات المصدر

المستودع
runceel/wpf-github-copilot
آخر نشاط في المصدر
١٨ أبريل ٢٠٢٦ في ٠٤:٥٨
لغة SKILL.md المكتشفة
الإنجليزية
النجوم
٠
التفرعات
٠

خيارات التثبيت

يُحدَّد Prompt الذي يراجع المصدر أولًا بشكل افتراضي. يمكنك التبديل إلى أمر مباشر أو تنزيل نسخة محلية.

مراجعة ملفات المصدر

اقرأ SKILL.md وأي ملفات مرافقة يعرضها SkillsMP قبل أن تقرر التثبيت.

عرض SKILL.md

SKILL.md
تعليمات المصدر · معاينة للقراءة فقط
name
dotnet-10
description
Provides up-to-date knowledge about .NET 10 and C# 14 for WPF application development. Use this skill when developing WPF apps targeting .NET 10, or when asked about .NET 10 / C# 14 features.
# .NET 10 + C# 14 WPF Development Reference .NET 10 is an LTS release (released November 2025, supported for 3 years). The paired language version is C# 14. The required tooling is .NET 10 SDK and Visual Studio 2026. ## Project Setup Target framework: `net10.0-windows` ```xml <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>WinExe</OutputType> <TargetFramework>net10.0-windows</TargetFramework> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> <UseWPF>true</UseWPF> </PropertyGroup> </Project> ``` ## C# 14 New Language Features ### `field` keyword (backed properties) Access the compiler-generated backing field inside a property accessor without declaring a separate field: ```csharp public string Name { get; set => field = value ?? throw new ArgumentNullException(nameof(value)); } ``` ### Extension members New `extension` block syntax supports extension properties (instance and static) in addition to extension methods: ```csharp public static class MyExtensions { extension(IEnumerable<int> source) { public bool IsEmpty => !source.Any(); } } ``` Use `sequence.IsEmpty` as if it were an instance property. ### Null-conditional assignment `?.` can now appear on the left-hand side of an assignment: ```csharp // Before C# 14: if (customer is not null) customer.Order = GetCurrentOrder(); // C# 14: customer?.Order = GetCurrentOrder(); ``` Also works with compound assignment (`+=`, `-=`, etc.). Increment/decrement (`++`/`--`) are not supported. ### `nameof` with unbound generic types ```csharp nameof(List<>) // returns "List" ``` ### Lambda parameter modifiers without explicit types ```csharp TryParse<int> parse = (text, out result) => int.TryParse(text, out result); ``` ### Implicit `Span<T>` / `ReadOnlySpan<T>` conversions C# 14 adds first-class implicit conversions between `Span<T>`, `ReadOnlySpan<T>`, and `T[]`. ### `partial` constructors and events Instance constructors and events can now be declared as `partial` members (one defining declaration, one implementing declaration). ### User-defined compound assignment and increment/decrement operators Types can now define `+=`, `-=`, `++`, `--`, etc. ## WPF Changes in .NET 10 ### Grid short-form syntax (new) Column/row definitions can be written inline as a string: ```xaml <!-- Before --> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="300" /> </Grid.ColumnDefinitions> </Grid> <!-- .NET 10 --> <Grid ColumnDefinitions="1*, Auto, 300" RowDefinitions="Auto, *, 25" /> ``` ### MessageBox new buttons and results (new) `MessageBoxButton` now includes: `AbortRetryIgnore`, `RetryCancel`, `CancelTryContinue`. `MessageBoxResult` now includes: `Abort`, `Retry`, `Ignore`, `TryAgain`, `Continue`. ### Clipboard changes WPF and Windows Forms now share the same clipboard API. `BinaryFormatter`-based clipboard methods are obsoleted; use JSON-based alternatives instead. ### Fluent style (in progress) .NET 10 expanded Fluent UI style support to additional controls: `DatePicker`, `GridSplitter`, `GridView`, `GroupBox`, `Hyperlink`, `Label`, `NavigationWindow`, `RichTextBox`, `TextBox`. Fluent style support is still incomplete; not all controls are covered yet. ### Performance improvements - Internal data structures replaced with `ReadOnlyCollection<T>` to reduce allocations. - Optimized font rendering, dynamic resources, XAML parsing, and cache operations. ### Removed legacy code Unused Code Access Security (CAS) code and XBAP-related code have been removed. Do not reference CAS APIs in .NET 10 WPF code. ## .NET 10 Runtime and SDK - JIT: improved inlining, method devirtualization, and stack allocation optimization. - AVX10.2 support added. - NativeAOT enhancements. - SDK: `dotnet test` now supports `Microsoft.Testing.Platform`; `dotnet tool exec` for one-shot tool execution. - Post-quantum cryptography: ML-DSA with HashML-DSA support, Composite ML-DSA, AES KeyWrap with Padding. - Networking: `WebSocketStream` API, TLS 1.3 on macOS. ## Guidance for Code Generation - Always use `net10.0-windows` as the target framework for WPF projects. - Use `<Nullable>enable</Nullable>` and `<ImplicitUsings>enable</ImplicitUsings>`. - Prefer the `field` keyword instead of explicit backing fields for simple validation cases. - Use the Grid inline syntax (`ColumnDefinitions="..."`) for conciseness. - Do not use `BinaryFormatter` for clipboard operations; use the new JSON-based clipboard APIs. - Do not reference CAS-related APIs (they have been removed). - C# 14 is the default language version when targeting .NET 10; no explicit `<LangVersion>` needed. ## Reference Links - [What's new in .NET 10](https://learn.microsoft.com/dotnet/core/whats-new/dotnet-10/overview) - [What's new in C# 14](https://learn.microsoft.com/dotnet/csharp/whats-new/csharp-14) - [What's new in WPF for .NET 10](https://learn.microsoft.com/dotnet/desktop/wpf/whats-new/net100)
عرض على GitHub