1
0
mirror of synced 2025-12-19 09:50:46 -05:00
Files
James Montemagno 215900a2bd .NET 10 Preview 5 (#9829)
* .NET 10 Preview 5

* update

* lint

* Add C# features in preview 5

Write the description for user defined compound assignment operators.

* Revert "Add C# features in preview 5"

This reverts commit 42e5ac6bff.

* Remove VB release notes for P5

There aren't notable new features in Visual Basic for Preview 5.

* Add notes about PQC

* Add PQC to the libraries ToC

* .NET 10 P5 - WinForms (#9919)

* winforms

* WinForms Preview 5

Preview 5 updates

* Fix duplicated intro

---------

Co-authored-by: Merrie McGaw <mmcgaw@microsoft.com>
Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>

* .NET 10 P5 - Containers (#9917)

* containers

* update for p5

* .NET 10 P5 - WPF (#9918)

* wpf

* Add notes

---------

Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>

* .NET 10 P5 Runtime (#9912)

* Update for Runtime

* Add JIT notes

* Fix GC notes

---------

Co-authored-by: Aman Khalid (from Dev Box) <amankhalid@microsoft.com>

* .NET 10 P5 - Languages (#9916)

* update csharp

* Add C# features in preview 5

Write the description for user defined compound assignment operators.

* Remove VB release notes for P5

There aren't notable new features in Visual Basic for Preview 5.

* Update fsharp.md

* Update fsharp.md

* Update fsharp.md

* add vb back just to link to docs

* update f#

* Update README.md

---------

Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>

* updates for lint

* update (#9915)

* update for sdk (#9914)

* some more updates

* .NET MAUI in 10 Preview 5 (#9921)

* .NET MAUI in 10 Preview 5

* Update dotnetmaui.md

* added contributors

* hybridwebview interception

* addressing comments

---------

Co-authored-by: James Montemagno <james.montemagno@gmail.com>

* linting

* Update release-notes/10.0/preview/preview5/README.md

Co-authored-by: Martin Costello <martin@martincostello.com>

* Update release-notes/10.0/preview/preview5/README.md

Co-authored-by: Martin Costello <martin@martincostello.com>

* Update ef and date

* updating md file

* Added updates to README

---------

Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
Co-authored-by: Merrie McGaw <mmcgaw@microsoft.com>
Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>
Co-authored-by: Aman Khalid (from Dev Box) <amankhalid@microsoft.com>
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>
Co-authored-by: David Ortinau <david.ortinau@microsoft.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: victorisr <victorisr@microsoft.com>
2025-06-10 09:57:27 -07:00

2.1 KiB

C# 14 updates in .NET 10 Preview 5 - Release Notes

Here's a summary of what's new in C# in this preview release:

C# 14 updates:

User defined compound assignment operators

This feature enables type authors to implement compound assignment operators in a manner that modifies the target in place rather than create copies.

For example, the += operator was defined to perform the addition and then an assignment. In other words, the code:

a += b;

Was the same as the following code:

a = a + b;

If the type of a was a class, a typical implementation of operator + creates a new instance of that type. The compound assignment operator impacts memory usage. The original instance of a becomes garbage and a newly allocated instance takes its place. For larger types, this causes unnecessary memory churn. That churn, in turn, causes increased memory pressure and creates more work for the garbage collector.

As more programs use Tensor types or other large data structures, this cost becomes more significant

Library authors can now create user defined implementations for any of the compound assignment operators: +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>= and >>>=. In addition, the +=, -=, *= and /= operators can include both checked and unchecked variants.

If you're maintaining a library with existing operators, you can decide if this new feature provides real benefit. Your existing code works the same as before. Consumers of your library can still use any of the compound assignment operators. Unless you define the new compound assignment operators, the compiler continues to generate the same code.

We continue to add features to C# that seamlessly provide new features for important new scenarios without changing familiar idioms.