Microsoft moves forward with C# 13, offering overload resolution



Microsoft, in its latest informational update on the planned C# 13 language release, is emphasizing capabilities such as overload resolution, with developers able to supply multiple params overloads when authoring a method, and partial properties, similar to partial methods.

The company published its latest blog on C# 13 on July 9. C# 13 is likely to be finalized in November, along with the latest update to the  planned .NET 9 software development platform. In detailing overload resolution, Microsoft said that when authoring a method, developers can supply multiple params overloads. This can reduce allocations, which can improve performance. Multiple overloads can both boost performance and add convenience. Library authors are advised to give all overloads the same semantics so callers do not need to be concerned about which overload is used. Partial properties, meanwhile, are described as being like partial method counterparts. It will be easier for source generator designers to create APIs with a natural feel.

Also in C# 13, the release refines the rules for determining the natural type to consider candidates by scope and to prune candidates with no chance of succeeding. Updating these rules means fewer compiler errors when working with method groups. The release, with allows ref struct, also adds a new way to specify capabilities for generic type parameters. By default, parameters cannot be ref struct. C# 13 lets developers specify the type can be a ref struct, and applies appropriate rules. When other generic constraints limit the set of types that can be used as a type parameter, the new specification expands the allowed types. This removes rather than adds a restriction.



Source link