diff --git a/.openpublishing.redirection.csharp.json b/.openpublishing.redirection.csharp.json index 93c2caf46fced..58d4498e7b703 100644 --- a/.openpublishing.redirection.csharp.json +++ b/.openpublishing.redirection.csharp.json @@ -120,6 +120,14 @@ "source_path_from_root": "/redirections/proposals/csharp-8.0/readonly-instance-members.md", "redirect_url": "/dotnet/csharp/language-reference/language-specification/structs#16411-properties" }, + { + "source_path_from_root": "/redirections/proposals/csharp-8.0/null-coalescing-assignment.md", + "redirect_url": "/dotnet/csharp/language-reference/language-specification/expressions#1221-assignment-operators" + }, + { + "source_path_from_root": "/redirections/proposals/csharp-8.0/async-streams.md", + "redirect_url": "/dotnet/csharp/language-reference/language-specification/statements.md#13953-await-foreach" + }, { "source_path_from_root": "/redirections/proposals/csharp-9.0/nullable-reference-types-specification.md", "redirect_url": "/dotnet/csharp/language-reference/language-specification/types.md#893-nullable-reference-types" diff --git a/docfx.json b/docfx.json index 55135a76a5f28..04c8f94c8bb60 100644 --- a/docfx.json +++ b/docfx.json @@ -60,7 +60,8 @@ "simple-lambda-parameters-with-modifiers.md", "partial-events-and-constructors.md", "null-conditional-assignment.md", - "extensions.md" + "extensions.md", + "user-defined-compound-assignment.md" ], "src": "_csharplang/proposals", "dest": "csharp/language-reference/proposals", @@ -81,6 +82,8 @@ "csharp-8.0/nullable-reference-types-specification.md", "csharp-8.0/nested-stackalloc.md", "csharp-8.0/readonly-instance-members.md", + "csharp-8.0/null-coalescing-assignment.md", + "csharp-8.0/async-streams.md", "csharp-9.0/nullable-reference-types-specification.md", "csharp-9.0/nullable-constructor-analysis.md", "csharp-9.0/nullable-parameter-default-value-analysis.md", @@ -618,10 +621,8 @@ "_csharpstandard/standard/Bibliography.md": "Bibliography", "_csharplang/proposals/csharp-8.0/patterns.md": "Recursive pattern matching", "_csharplang/proposals/csharp-8.0/default-interface-methods.md": "Default interface methods", - "_csharplang/proposals/csharp-8.0/async-streams.md": "Async streams", "_csharplang/proposals/csharp-8.0/ranges.md": "Ranges and indices", "_csharplang/proposals/csharp-8.0/using.md": "Pattern based using and using declarations", - "_csharplang/proposals/csharp-8.0/null-coalescing-assignment.md": "Null coalescing assignment", "_csharplang/proposals/csharp-9.0/covariant-returns.md": "Covariant return types", "_csharplang/proposals/csharp-9.0/extending-partial-methods.md": "Extending partial methods", "_csharplang/proposals/csharp-9.0/extension-getenumerator.md": "Extension GetEnumerator support in foreach", @@ -691,6 +692,7 @@ "_csharplang/proposals/partial-events-and-constructors.md": "Partial events and constructors", "_csharplang/proposals/null-conditional-assignment.md": "Null conditional assignment", "_csharplang/proposals/extensions.md": "Extension members", + "_csharplang/proposals/user-defined-compound-assignment.md": "User-defined compound assignment", "_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md": "C# compiler breaking changes since C# 10", "_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 8.md": "C# compiler breaking changes since C# 11", "_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 9.md": "C# compiler breaking changes since C# 12", @@ -744,10 +746,8 @@ "_csharpstandard/standard/Bibliography.md": "This appendix lists external standards referenced in this specification.", "_csharplang/proposals/csharp-8.0/patterns.md": "This feature specification describes recursive pattern matching, where patterns can nest inside other patterns.", "_csharplang/proposals/csharp-8.0/default-interface-methods.md": "This feature specification describe the syntax updates necessary to support default interface methods. This includes declaring bodies in interface declarations, and supporting modifiers on declarations.", - "_csharplang/proposals/csharp-8.0/async-streams.md": "This feature specification describes async streams, which return streams of data asynchronously, typically as each element is produced or available.", "_csharplang/proposals/csharp-8.0/ranges.md": "This feature specification describes the syntax for ranges and indices, which support indexing individual elements of a sequence or a range of a sequence from the start or end of that sequence.", "_csharplang/proposals/csharp-8.0/using.md": "This feature specification supports pattern based using and using declarations to simplify resource cleanup.", - "_csharplang/proposals/csharp-8.0/null-coalescing-assignment.md": "This feature specification describes the syntax to support null coalescing assignment expressions using the '??=' operator.", "_csharplang/proposals/csharp-9.0/covariant-returns.md": "This feature specification describes covariant return types, where overriding member declarations can return a type derived from the overridden member declaration.", "_csharplang/proposals/csharp-9.0/extending-partial-methods.md": "This feature specification describes extensions to partial methods. These extensions enable source generators to create or call partial methods.", "_csharplang/proposals/csharp-9.0/extension-getenumerator.md": "This feature specification describes the necessary pattern for an extension method to provide the GetEnumerator support in a foreach loop.", @@ -817,6 +817,7 @@ "_csharplang/proposals/partial-events-and-constructors.md": "This proposal allows partial events and constructors to be declared in partial classes. The event and constructor can be split across class declarations.", "_csharplang/proposals/null-conditional-assignment.md": "This proposal allows the null conditional operator to be used for the destination of assignment expressions. This allows you to assign a value to a property or field only if the left side is not null.", "_csharplang/proposals/extensions.md": "This proposal enables new kinds of extension members. These new extension members support extension properties, extension static members, including extension operators.", + "_csharplang/proposals/user-defined-compound-assignment.md": "This proposal introduces user-defined compound assignment operators. Developers can override compound assignment, increment, and decrement operators.", "_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md": "Learn about any breaking changes since the initial release of C# 10 and included in C# 11", "_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 8.md": "Learn about any breaking changes since the initial release of C# 11 and included in C# 12", "_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 9.md": "Learn about any breaking changes since the initial release of C# 12 and included in C# 13", diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 14eb4f35dc163..40868e1eae520 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -22,7 +22,7 @@ | Communication Messages | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Communication.Messages/1.1.0)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Messages/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.Messages-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Messages_1.1.0/sdk/communication/Azure.Communication.Messages/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Messages_1.3.0-beta.1/sdk/communication/Azure.Communication.Messages/) | | Communication Phone Numbers | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Communication.PhoneNumbers/1.3.0)
NuGet [1.4.0-beta.1](https://www.nuget.org/packages/Azure.Communication.PhoneNumbers/1.4.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.PhoneNumbers-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.PhoneNumbers_1.3.0/sdk/communication/Azure.Communication.PhoneNumbers/)
GitHub [1.4.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.PhoneNumbers_1.4.0-beta.1/sdk/communication/Azure.Communication.PhoneNumbers/) | | Communication Rooms | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Communication.Rooms/1.2.0) | [docs](/dotnet/api/overview/azure/Communication.Rooms-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Rooms_1.2.0/sdk/communication/Azure.Communication.Rooms/) | -| Communication SMS | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Sms/1.0.1)
NuGet [1.1.0-beta.2](https://www.nuget.org/packages/Azure.Communication.Sms/1.1.0-beta.2) | [docs](/dotnet/api/overview/azure/Communication.Sms-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Sms_1.0.1/sdk/communication/Azure.Communication.Sms/)
GitHub [1.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Sms_1.1.0-beta.2/sdk/communication/Azure.Communication.Sms/) | +| Communication SMS | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Sms/1.0.1)
NuGet [1.1.0-beta.3](https://www.nuget.org/packages/Azure.Communication.Sms/1.1.0-beta.3) | [docs](/dotnet/api/overview/azure/Communication.Sms-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Sms_1.0.1/sdk/communication/Azure.Communication.Sms/)
GitHub [1.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Sms_1.1.0-beta.3/sdk/communication/Azure.Communication.Sms/) | | Compute Batch | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Compute.Batch/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Compute.Batch-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Compute.Batch_1.0.0-beta.2/sdk/batch/Azure.Compute.Batch/) | | Confidential Ledger | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Security.ConfidentialLedger/1.3.0)
NuGet [1.4.1-beta.2](https://www.nuget.org/packages/Azure.Security.ConfidentialLedger/1.4.1-beta.2) | [docs](/dotnet/api/overview/azure/Security.ConfidentialLedger-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.ConfidentialLedger_1.3.0/sdk/confidentialledger/Azure.Security.ConfidentialLedger/)
GitHub [1.4.1-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.ConfidentialLedger_1.4.1-beta.2/sdk/confidentialledger/Azure.Security.ConfidentialLedger/) | | Container Registry | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Containers.ContainerRegistry/1.2.0) | [docs](/dotnet/api/overview/azure/Containers.ContainerRegistry-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Containers.ContainerRegistry_1.2.0/sdk/containerregistry/Azure.Containers.ContainerRegistry/) | @@ -44,7 +44,7 @@ | Document Translation | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Document/2.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Document-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Document_2.0.0/sdk/translation/Azure.AI.Translation.Document/) | | Event Grid | NuGet [4.31.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid/4.31.0)
NuGet [5.0.0-beta.1](https://www.nuget.org/packages/Azure.Messaging.EventGrid/5.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid-readme) | GitHub [4.31.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid_4.31.0/sdk/eventgrid/Azure.Messaging.EventGrid/)
GitHub [5.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid_5.0.0-beta.1/sdk/eventgrid/Azure.Messaging.EventGrid/) | | Event Grid Namespaces | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid.Namespaces/1.1.0) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid.Namespaces-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid.Namespaces_1.1.0/sdk/eventgrid/Azure.Messaging.EventGrid.Namespaces/) | -| Event Hubs | NuGet [5.12.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs/5.12.1) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs-readme) | GitHub [5.12.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs_5.12.1/sdk/eventhub/Azure.Messaging.EventHubs/) | +| Event Hubs | NuGet [5.12.2](https://www.nuget.org/packages/Azure.Messaging.EventHubs/5.12.2) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs-readme) | GitHub [5.12.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs_5.12.2/sdk/eventhub/Azure.Messaging.EventHubs/) | | Event Hubs - Event Processor | NuGet [5.12.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs.Processor/5.12.1) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs.Processor-readme) | GitHub [5.12.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs.Processor_5.12.1/sdk/eventhub/Azure.Messaging.EventHubs.Processor/) | | Face | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Vision.Face/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Vision.Face-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Vision.Face_1.0.0-beta.2/sdk/face/Azure.AI.Vision.Face/) | | FarmBeats | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Verticals.AgriFood.Farming/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Verticals.AgriFood.Farming-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Verticals.AgriFood.Farming_1.0.0-beta.2/sdk/agrifood/Azure.Verticals.AgriFood.Farming/) | @@ -55,7 +55,7 @@ | Health Insights Clinical Matching | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Health.Insights.ClinicalMatching/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Health.Insights.ClinicalMatching-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.ClinicalMatching_1.0.0-beta.1/sdk/healthinsights/Azure.Health.Insights.ClinicalMatching/) | | Health Insights Radiology Insights | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Health.Insights.RadiologyInsights/1.0.0) | [docs](/dotnet/api/overview/azure/Health.Insights.RadiologyInsights-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.RadiologyInsights_1.0.0/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/) | | Identity | NuGet [1.14.0](https://www.nuget.org/packages/Azure.Identity/1.14.0) | [docs](/dotnet/api/overview/azure/Identity-readme) | GitHub [1.14.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.14.0/sdk/identity/Azure.Identity/) | -| Identity Broker | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Identity.Broker/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Identity.Broker/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Identity.Broker-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.2.0/sdk/identity/Azure.Identity.Broker/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.3.0-beta.2/sdk/identity/Azure.Identity.Broker/) | +| Identity Broker | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Identity.Broker/1.2.0)
NuGet [1.3.0-beta.3](https://www.nuget.org/packages/Azure.Identity.Broker/1.3.0-beta.3) | [docs](/dotnet/api/overview/azure/Identity.Broker-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.2.0/sdk/identity/Azure.Identity.Broker/)
GitHub [1.3.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.3.0-beta.3/sdk/identity/Azure.Identity.Broker/) | | Image Analysis | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Vision.ImageAnalysis/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Vision.ImageAnalysis-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Vision.ImageAnalysis_1.0.0/sdk/vision/Azure.AI.Vision.ImageAnalysis/) | | Key Vault - Administration | NuGet [4.5.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.5.0)
NuGet [4.6.0-beta.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.6.0-beta.1) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Administration-readme) | GitHub [4.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.5.0/sdk/keyvault/Azure.Security.KeyVault.Administration/)
GitHub [4.6.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.6.0-beta.1/sdk/keyvault/Azure.Security.KeyVault.Administration/) | | Key Vault - Certificates | NuGet [4.7.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.7.0)
NuGet [4.8.0-beta.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.8.0-beta.1) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Certificates-readme) | GitHub [4.7.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.7.0/sdk/keyvault/Azure.Security.KeyVault.Certificates/)
GitHub [4.8.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.8.0-beta.1/sdk/keyvault/Azure.Security.KeyVault.Certificates/) | @@ -97,7 +97,7 @@ | Question Answering | NuGet [1.1.0](https://www.nuget.org/packages/Azure.AI.Language.QuestionAnswering/1.1.0) | [docs](/dotnet/api/overview/azure/AI.Language.QuestionAnswering-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Language.QuestionAnswering_1.1.0/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/) | | Schema Registry | NuGet [1.4.0](https://www.nuget.org/packages/Azure.Data.SchemaRegistry/1.4.0) | [docs](/dotnet/api/overview/azure/Data.SchemaRegistry-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.SchemaRegistry_1.4.0/sdk/schemaregistry/Azure.Data.SchemaRegistry/) | | Schema Registry - Avro | NuGet [1.0.1](https://www.nuget.org/packages/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/1.0.1) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro_1.0.1/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/) | -| Service Bus | NuGet [7.19.0](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.19.0) | [docs](/dotnet/api/overview/azure/Messaging.ServiceBus-readme) | GitHub [7.19.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.19.0/sdk/servicebus/Azure.Messaging.ServiceBus/) | +| Service Bus | NuGet [7.20.1](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.20.1) | [docs](/dotnet/api/overview/azure/Messaging.ServiceBus-readme) | GitHub [7.20.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.20.1/sdk/servicebus/Azure.Messaging.ServiceBus/) | | Storage - Blobs | NuGet [12.24.1](https://www.nuget.org/packages/Azure.Storage.Blobs/12.24.1)
NuGet [12.26.0-beta.1](https://www.nuget.org/packages/Azure.Storage.Blobs/12.26.0-beta.1) | [docs](/dotnet/api/overview/azure/Storage.Blobs-readme) | GitHub [12.24.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs_12.24.1/sdk/storage/Azure.Storage.Blobs/)
GitHub [12.26.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs_12.26.0-beta.1/sdk/storage/Azure.Storage.Blobs/) | | Storage - Blobs Batch | NuGet [12.21.0](https://www.nuget.org/packages/Azure.Storage.Blobs.Batch/12.21.0)
NuGet [12.23.0-beta.1](https://www.nuget.org/packages/Azure.Storage.Blobs.Batch/12.23.0-beta.1) | [docs](/dotnet/api/overview/azure/Storage.Blobs.Batch-readme) | GitHub [12.21.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs.Batch_12.21.0/sdk/storage/Azure.Storage.Blobs.Batch/)
GitHub [12.23.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs.Batch_12.23.0-beta.1/sdk/storage/Azure.Storage.Blobs.Batch/) | | Storage - Blobs ChangeFeed | NuGet [12.0.0-preview.56](https://www.nuget.org/packages/Azure.Storage.Blobs.ChangeFeed/12.0.0-preview.56) | [docs](/dotnet/api/overview/azure/Storage.Blobs.ChangeFeed-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [12.0.0-preview.56](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs.ChangeFeed_12.0.0-preview.56/sdk/storage/Azure.Storage.Blobs.ChangeFeed/) | @@ -117,7 +117,7 @@ | Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_1.0.0/sdk/translation/Azure.AI.Translation.Text/) | | Time Series Insights | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.IoT.TimeSeriesInsights/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/IoT.TimeSeriesInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.TimeSeriesInsights_1.0.0-beta.1/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/) | | TimeZone | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Maps.TimeZones/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Maps.TimeZones-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Maps.TimeZones_1.0.0-beta.1/sdk/maps/Azure.Maps.TimeZones/) | -| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.OnlineExperimentation/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.OnlineExperimentation_1.0.0-beta.1/sdk/onlineexperimentation/Azure.Analytics.OnlineExperimentation/) | +| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.OnlineExperimentation/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Analytics.OnlineExperimentation-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.OnlineExperimentation_1.0.0-beta.1/sdk/onlineexperimentation/Azure.Analytics.OnlineExperimentation/) | | unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Projects/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Projects-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Projects_1.0.0-beta.1/sdk/cloudmachine/Azure.Projects/) | | unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Projects.AI/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Projects.AI-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Projects.AI_1.0.0-beta.1/sdk/cloudmachine/Azure.Projects.AI/) | | unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Projects.Provisioning/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Projects.Provisioning-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Projects.Provisioning_1.0.0-beta.1/sdk/cloudmachine/Azure.Projects.Provisioning/) | @@ -126,7 +126,7 @@ | WCF Storage Queues | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.WCF.Azure.StorageQueues/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.WCF.Azure.StorageQueues-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.WCF.Azure.StorageQueues_1.0.0-beta.1/sdk/extension-wcf/Microsoft.WCF.Azure.StorageQueues/) | | Web PubSub | NuGet [1.6.0](https://www.nuget.org/packages/Azure.Messaging.WebPubSub/1.6.0) | [docs](/dotnet/api/overview/azure/Messaging.WebPubSub-readme) | GitHub [1.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.WebPubSub_1.6.0/sdk/webpubsub/Azure.Messaging.WebPubSub/) | | Web PubSub Client | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Messaging.WebPubSub.Client/1.0.0) | [docs](/dotnet/api/overview/azure/Messaging.WebPubSub.Client-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.WebPubSub.Client_1.0.0/sdk/webpubsub/Azure.Messaging.WebPubSub.Client/) | -| Azure client library integration for ASP.NET Core | NuGet [1.11.0](https://www.nuget.org/packages/Microsoft.Extensions.Azure/1.11.0) | [docs](/dotnet/api/overview/azure/Microsoft.Extensions.Azure-readme) | GitHub [1.11.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Extensions.Azure_1.11.0/sdk/extensions/Microsoft.Extensions.Azure/) | +| Azure client library integration for ASP.NET Core | NuGet [1.12.0](https://www.nuget.org/packages/Microsoft.Extensions.Azure/1.12.0) | [docs](/dotnet/api/overview/azure/Microsoft.Extensions.Azure-readme) | GitHub [1.12.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Extensions.Azure_1.12.0/sdk/extensions/Microsoft.Extensions.Azure/) | | Blob Storage Key Store for .NET Data Protection | NuGet [1.5.0](https://www.nuget.org/packages/Azure.Extensions.AspNetCore.DataProtection.Blobs/1.5.0) | [docs](/dotnet/api/overview/azure/Extensions.AspNetCore.DataProtection.Blobs-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Extensions.AspNetCore.DataProtection.Blobs_1.5.0/sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Blobs/) | | CloudNative CloudEvents with Event Grid | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/1.0.0) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents_1.0.0/sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/) | | Core - Client - Spatial | NuGet [1.1.0](https://www.nuget.org/packages/Microsoft.Azure.Core.Spatial/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.Core.Spatial/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.Core.Spatial-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Core.Spatial_1.1.0/sdk/core/Microsoft.Azure.Core.Spatial/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Core.Spatial_1.2.0-beta.1/sdk/core/Microsoft.Azure.Core.Spatial/) | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 325f50e18968f..4fb856dfc3722 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -23,7 +23,7 @@ | Communication Network Traversal | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Communication.NetworkTraversal/1.0.0)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Communication.NetworkTraversal/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.NetworkTraversal-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.NetworkTraversal_1.0.0/sdk/communication/Azure.Communication.NetworkTraversal/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.NetworkTraversal_1.1.0-beta.1/sdk/communication/Azure.Communication.NetworkTraversal/) | | Communication Phone Numbers | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Communication.PhoneNumbers/1.3.0)
NuGet [1.4.0-beta.1](https://www.nuget.org/packages/Azure.Communication.PhoneNumbers/1.4.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.PhoneNumbers-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.PhoneNumbers_1.3.0/sdk/communication/Azure.Communication.PhoneNumbers/)
GitHub [1.4.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.PhoneNumbers_1.4.0-beta.1/sdk/communication/Azure.Communication.PhoneNumbers/) | | Communication Rooms | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Communication.Rooms/1.2.0) | [docs](/dotnet/api/overview/azure/Communication.Rooms-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Rooms_1.2.0/sdk/communication/Azure.Communication.Rooms/) | -| Communication SMS | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Sms/1.0.1)
NuGet [1.1.0-beta.2](https://www.nuget.org/packages/Azure.Communication.Sms/1.1.0-beta.2) | [docs](/dotnet/api/overview/azure/Communication.Sms-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Sms_1.0.1/sdk/communication/Azure.Communication.Sms/)
GitHub [1.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Sms_1.1.0-beta.2/sdk/communication/Azure.Communication.Sms/) | +| Communication SMS | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Sms/1.0.1)
NuGet [1.1.0-beta.3](https://www.nuget.org/packages/Azure.Communication.Sms/1.1.0-beta.3) | [docs](/dotnet/api/overview/azure/Communication.Sms-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Sms_1.0.1/sdk/communication/Azure.Communication.Sms/)
GitHub [1.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Sms_1.1.0-beta.3/sdk/communication/Azure.Communication.Sms/) | | Compute Batch | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Compute.Batch/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Compute.Batch-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Compute.Batch_1.0.0-beta.2/sdk/batch/Azure.Compute.Batch/) | | Confidential Ledger | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Security.ConfidentialLedger/1.3.0)
NuGet [1.4.1-beta.2](https://www.nuget.org/packages/Azure.Security.ConfidentialLedger/1.4.1-beta.2) | [docs](/dotnet/api/overview/azure/Security.ConfidentialLedger-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.ConfidentialLedger_1.3.0/sdk/confidentialledger/Azure.Security.ConfidentialLedger/)
GitHub [1.4.1-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.ConfidentialLedger_1.4.1-beta.2/sdk/confidentialledger/Azure.Security.ConfidentialLedger/) | | Container Registry | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Containers.ContainerRegistry/1.2.0) | [docs](/dotnet/api/overview/azure/Containers.ContainerRegistry-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Containers.ContainerRegistry_1.2.0/sdk/containerregistry/Azure.Containers.ContainerRegistry/) | @@ -45,7 +45,7 @@ | Document Translation | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Document/2.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Document-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Document_2.0.0/sdk/translation/Azure.AI.Translation.Document/) | | Event Grid | NuGet [4.31.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid/4.31.0)
NuGet [5.0.0-beta.1](https://www.nuget.org/packages/Azure.Messaging.EventGrid/5.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid-readme) | GitHub [4.31.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid_4.31.0/sdk/eventgrid/Azure.Messaging.EventGrid/)
GitHub [5.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid_5.0.0-beta.1/sdk/eventgrid/Azure.Messaging.EventGrid/) | | Event Grid Namespaces | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid.Namespaces/1.1.0) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid.Namespaces-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid.Namespaces_1.1.0/sdk/eventgrid/Azure.Messaging.EventGrid.Namespaces/) | -| Event Hubs | NuGet [5.12.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs/5.12.1) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs-readme) | GitHub [5.12.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs_5.12.1/sdk/eventhub/Azure.Messaging.EventHubs/) | +| Event Hubs | NuGet [5.12.2](https://www.nuget.org/packages/Azure.Messaging.EventHubs/5.12.2) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs-readme) | GitHub [5.12.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs_5.12.2/sdk/eventhub/Azure.Messaging.EventHubs/) | | Event Hubs - Event Processor | NuGet [5.12.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs.Processor/5.12.1) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs.Processor-readme) | GitHub [5.12.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs.Processor_5.12.1/sdk/eventhub/Azure.Messaging.EventHubs.Processor/) | | Face | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Vision.Face/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Vision.Face-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Vision.Face_1.0.0-beta.2/sdk/face/Azure.AI.Vision.Face/) | | FarmBeats | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Verticals.AgriFood.Farming/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Verticals.AgriFood.Farming-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Verticals.AgriFood.Farming_1.0.0-beta.2/sdk/agrifood/Azure.Verticals.AgriFood.Farming/) | @@ -56,7 +56,7 @@ | Health Insights Clinical Matching | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Health.Insights.ClinicalMatching/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Health.Insights.ClinicalMatching-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.ClinicalMatching_1.0.0-beta.1/sdk/healthinsights/Azure.Health.Insights.ClinicalMatching/) | | Health Insights Radiology Insights | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Health.Insights.RadiologyInsights/1.0.0) | [docs](/dotnet/api/overview/azure/Health.Insights.RadiologyInsights-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.RadiologyInsights_1.0.0/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/) | | Identity | NuGet [1.14.0](https://www.nuget.org/packages/Azure.Identity/1.14.0) | [docs](/dotnet/api/overview/azure/Identity-readme) | GitHub [1.14.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.14.0/sdk/identity/Azure.Identity/) | -| Identity Broker | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Identity.Broker/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Identity.Broker/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Identity.Broker-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.2.0/sdk/identity/Azure.Identity.Broker/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.3.0-beta.2/sdk/identity/Azure.Identity.Broker/) | +| Identity Broker | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Identity.Broker/1.2.0)
NuGet [1.3.0-beta.3](https://www.nuget.org/packages/Azure.Identity.Broker/1.3.0-beta.3) | [docs](/dotnet/api/overview/azure/Identity.Broker-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.2.0/sdk/identity/Azure.Identity.Broker/)
GitHub [1.3.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.3.0-beta.3/sdk/identity/Azure.Identity.Broker/) | | Image Analysis | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Vision.ImageAnalysis/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Vision.ImageAnalysis-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Vision.ImageAnalysis_1.0.0/sdk/vision/Azure.AI.Vision.ImageAnalysis/) | | Key Vault - Administration | NuGet [4.5.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.5.0)
NuGet [4.6.0-beta.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.6.0-beta.1) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Administration-readme) | GitHub [4.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.5.0/sdk/keyvault/Azure.Security.KeyVault.Administration/)
GitHub [4.6.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.6.0-beta.1/sdk/keyvault/Azure.Security.KeyVault.Administration/) | | Key Vault - Certificates | NuGet [4.7.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.7.0)
NuGet [4.8.0-beta.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.8.0-beta.1) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Certificates-readme) | GitHub [4.7.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.7.0/sdk/keyvault/Azure.Security.KeyVault.Certificates/)
GitHub [4.8.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.8.0-beta.1/sdk/keyvault/Azure.Security.KeyVault.Certificates/) | @@ -101,7 +101,7 @@ | Question Answering | NuGet [1.1.0](https://www.nuget.org/packages/Azure.AI.Language.QuestionAnswering/1.1.0) | [docs](/dotnet/api/overview/azure/AI.Language.QuestionAnswering-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Language.QuestionAnswering_1.1.0/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/) | | Schema Registry | NuGet [1.4.0](https://www.nuget.org/packages/Azure.Data.SchemaRegistry/1.4.0) | [docs](/dotnet/api/overview/azure/Data.SchemaRegistry-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.SchemaRegistry_1.4.0/sdk/schemaregistry/Azure.Data.SchemaRegistry/) | | Schema Registry - Avro | NuGet [1.0.1](https://www.nuget.org/packages/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/1.0.1) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro_1.0.1/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/) | -| Service Bus | NuGet [7.19.0](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.19.0) | [docs](/dotnet/api/overview/azure/Messaging.ServiceBus-readme) | GitHub [7.19.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.19.0/sdk/servicebus/Azure.Messaging.ServiceBus/) | +| Service Bus | NuGet [7.20.1](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.20.1) | [docs](/dotnet/api/overview/azure/Messaging.ServiceBus-readme) | GitHub [7.20.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.20.1/sdk/servicebus/Azure.Messaging.ServiceBus/) | | Storage - Blobs | NuGet [12.24.1](https://www.nuget.org/packages/Azure.Storage.Blobs/12.24.1)
NuGet [12.26.0-beta.1](https://www.nuget.org/packages/Azure.Storage.Blobs/12.26.0-beta.1) | [docs](/dotnet/api/overview/azure/Storage.Blobs-readme) | GitHub [12.24.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs_12.24.1/sdk/storage/Azure.Storage.Blobs/)
GitHub [12.26.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs_12.26.0-beta.1/sdk/storage/Azure.Storage.Blobs/) | | Storage - Blobs Batch | NuGet [12.21.0](https://www.nuget.org/packages/Azure.Storage.Blobs.Batch/12.21.0)
NuGet [12.23.0-beta.1](https://www.nuget.org/packages/Azure.Storage.Blobs.Batch/12.23.0-beta.1) | [docs](/dotnet/api/overview/azure/Storage.Blobs.Batch-readme) | GitHub [12.21.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs.Batch_12.21.0/sdk/storage/Azure.Storage.Blobs.Batch/)
GitHub [12.23.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs.Batch_12.23.0-beta.1/sdk/storage/Azure.Storage.Blobs.Batch/) | | Storage - Blobs ChangeFeed | NuGet [12.0.0-preview.56](https://www.nuget.org/packages/Azure.Storage.Blobs.ChangeFeed/12.0.0-preview.56) | [docs](/dotnet/api/overview/azure/Storage.Blobs.ChangeFeed-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [12.0.0-preview.56](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs.ChangeFeed_12.0.0-preview.56/sdk/storage/Azure.Storage.Blobs.ChangeFeed/) | @@ -121,7 +121,7 @@ | Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_1.0.0/sdk/translation/Azure.AI.Translation.Text/) | | Time Series Insights | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.IoT.TimeSeriesInsights/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/IoT.TimeSeriesInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.TimeSeriesInsights_1.0.0-beta.1/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/) | | TimeZone | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Maps.TimeZones/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Maps.TimeZones-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Maps.TimeZones_1.0.0-beta.1/sdk/maps/Azure.Maps.TimeZones/) | -| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.OnlineExperimentation/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.OnlineExperimentation_1.0.0-beta.1/sdk/onlineexperimentation/Azure.Analytics.OnlineExperimentation/) | +| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.OnlineExperimentation/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Analytics.OnlineExperimentation-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.OnlineExperimentation_1.0.0-beta.1/sdk/onlineexperimentation/Azure.Analytics.OnlineExperimentation/) | | unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Projects/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Projects-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Projects_1.0.0-beta.1/sdk/cloudmachine/Azure.Projects/) | | unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Projects.AI/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Projects.AI-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Projects.AI_1.0.0-beta.1/sdk/cloudmachine/Azure.Projects.AI/) | | unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Projects.Provisioning/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Projects.Provisioning-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Projects.Provisioning_1.0.0-beta.1/sdk/cloudmachine/Azure.Projects.Provisioning/) | @@ -131,7 +131,7 @@ | WCF Storage Queues | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.WCF.Azure.StorageQueues/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.WCF.Azure.StorageQueues-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.WCF.Azure.StorageQueues_1.0.0-beta.1/sdk/extension-wcf/Microsoft.WCF.Azure.StorageQueues/) | | Web PubSub | NuGet [1.6.0](https://www.nuget.org/packages/Azure.Messaging.WebPubSub/1.6.0) | [docs](/dotnet/api/overview/azure/Messaging.WebPubSub-readme) | GitHub [1.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.WebPubSub_1.6.0/sdk/webpubsub/Azure.Messaging.WebPubSub/) | | Web PubSub Client | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Messaging.WebPubSub.Client/1.0.0) | [docs](/dotnet/api/overview/azure/Messaging.WebPubSub.Client-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.WebPubSub.Client_1.0.0/sdk/webpubsub/Azure.Messaging.WebPubSub.Client/) | -| Azure client library integration for ASP.NET Core | NuGet [1.11.0](https://www.nuget.org/packages/Microsoft.Extensions.Azure/1.11.0) | [docs](/dotnet/api/overview/azure/Microsoft.Extensions.Azure-readme) | GitHub [1.11.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Extensions.Azure_1.11.0/sdk/extensions/Microsoft.Extensions.Azure/) | +| Azure client library integration for ASP.NET Core | NuGet [1.12.0](https://www.nuget.org/packages/Microsoft.Extensions.Azure/1.12.0) | [docs](/dotnet/api/overview/azure/Microsoft.Extensions.Azure-readme) | GitHub [1.12.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Extensions.Azure_1.12.0/sdk/extensions/Microsoft.Extensions.Azure/) | | Blob Storage Key Store for .NET Data Protection | NuGet [1.5.0](https://www.nuget.org/packages/Azure.Extensions.AspNetCore.DataProtection.Blobs/1.5.0) | [docs](/dotnet/api/overview/azure/Extensions.AspNetCore.DataProtection.Blobs-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Extensions.AspNetCore.DataProtection.Blobs_1.5.0/sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Blobs/) | | CloudNative CloudEvents with Event Grid | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/1.0.0) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents_1.0.0/sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/) | | Core - Client - Spatial | NuGet [1.1.0](https://www.nuget.org/packages/Microsoft.Azure.Core.Spatial/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.Core.Spatial/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.Core.Spatial-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Core.Spatial_1.1.0/sdk/core/Microsoft.Azure.Core.Spatial/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Core.Spatial_1.2.0-beta.1/sdk/core/Microsoft.Azure.Core.Spatial/) | diff --git a/docs/core/tools/dotnet-test.md b/docs/core/tools/dotnet-test.md index fc85473800974..a5f765d6f3b59 100644 --- a/docs/core/tools/dotnet-test.md +++ b/docs/core/tools/dotnet-test.md @@ -437,6 +437,8 @@ dotnet test [--no-ansi] [--no-progress] [--output ] + [--no-launch-profile] + [--no-launch-profile-arguments] [...] dotnet test -h|--help @@ -523,6 +525,14 @@ With Microsoft Testing Platform, `dotnet test` operates faster than with VSTest. Specifies the output verbosity when reporting tests. Valid values are `Normal` and `Detailed`. The default is `Normal`. +- **`--no-launch-profile`** + + Do not attempt to use launchSettings.json to configure the application. By default, `launchSettings.json` is used, which can apply environment variables and command-line arguments to the test executable. + +- **`--no-launch-profile-arguments`** + + Do not use arguments specified by `commandLineArgs` in launch profile to run the application. + - **`--property:=`** Sets one or more MSBuild properties. Specify multiple properties by repeating the option: diff --git a/docs/core/whats-new/dotnet-10/overview.md b/docs/core/whats-new/dotnet-10/overview.md index fe9149e80a94e..f388c69ea85cb 100644 --- a/docs/core/whats-new/dotnet-10/overview.md +++ b/docs/core/whats-new/dotnet-10/overview.md @@ -54,6 +54,8 @@ C# 14 introduces several new features and enhancements to improve developer prod - Support for partial instance constructors and partial events, complementing partial methods and properties introduced in C# 13. - New `extension` blocks add support for static extension methods, and static and instance extension properties. - Null-conditional assignment using the `?.` operator. +- User-defined compound assignment operators like `+=` and `-=`. +- User-defined increment (`++`) and decrement (`--`) operators. For more information, see [What's new in C# 14](../../../csharp/whats-new/csharp-14.md). diff --git a/docs/csharp/asynchronous-programming/async-return-types.md b/docs/csharp/asynchronous-programming/async-return-types.md index 684e850ba6251..140ace1bed4d3 100644 --- a/docs/csharp/asynchronous-programming/async-return-types.md +++ b/docs/csharp/asynchronous-programming/async-return-types.md @@ -71,7 +71,7 @@ The following example shows the behavior of an async event handler. In the examp ## Generalized async return types and ValueTask\ -An async method can return any type that has an accessible `GetAwaiter` method that returns an instance of an *awaiter type*. In addition, the type returned from the `GetAwaiter` method must have the attribute. You can learn more in the article on [Attributes read by the compiler](../language-reference/attributes/general.md#asyncmethodbuilder-attribute) or the C# spec for the [Task type builder pattern](~/_csharpstandard/standard/classes.md#15152-task-type-builder-pattern). +An async method can return any type that has an accessible `GetAwaiter` method that returns an instance of an *awaiter type*. In addition, the type returned from the `GetAwaiter` method must have the attribute. You can learn more in the article on [Attributes read by the compiler](../language-reference/attributes/general.md#asyncmethodbuilder-attribute) or the C# spec for the [Task type builder pattern](~/_csharpstandard/standard/classes.md#15142-task-type-builder-pattern). This feature is the complement to [awaitable expressions](~/_csharpstandard/standard/expressions.md#12982-awaitable-expressions), which describes the requirements for the operand of `await`. Generalized async return types enable the compiler to generate `async` methods that return different types. Generalized async return types enabled performance improvements in the .NET libraries. Because and are reference types, memory allocation in performance-critical paths, particularly when allocations occur in tight loops, can adversely affect performance. Support for generalized return types means that you can return a lightweight value type instead of a reference type to avoid more memory allocations. diff --git a/docs/csharp/language-reference/operators/addition-operator.md b/docs/csharp/language-reference/operators/addition-operator.md index 6581909a498c1..14aea62365bda 100644 --- a/docs/csharp/language-reference/operators/addition-operator.md +++ b/docs/csharp/language-reference/operators/addition-operator.md @@ -1,7 +1,7 @@ --- title: "Addition operators - + and +=" description: "The C# addition operators (`+`, and `+=`) work with operands of numeric, string, or delegate types." -ms.date: 11/22/2024 +ms.date: 06/11/2025 f1_keywords: - "+_CSharpKeyword" - "+=_CSharpKeyword" @@ -16,7 +16,7 @@ helpviewer_keywords: --- # Addition operators - `+` and `+=` -The `+` and `+=` operators are supported by the built-in [integral](../builtin-types/integral-numeric-types.md) and [floating-point](../builtin-types/floating-point-numeric-types.md) numeric types, the [string](../builtin-types/reference-types.md#the-string-type) type, and [delegate](../builtin-types/reference-types.md#the-delegate-type) types. +The built-in [integral](../builtin-types/integral-numeric-types.md) and [floating-point](../builtin-types/floating-point-numeric-types.md) numeric types, the [string](../builtin-types/reference-types.md#the-string-type) type, and [delegate](../builtin-types/reference-types.md#the-delegate-type) types all support the `+` and `+=` operators. For information about the arithmetic `+` operator, see the [Unary plus and minus operators](arithmetic-operators.md#unary-plus-and-minus-operators) and [Addition operator +](arithmetic-operators.md#addition-operator-) sections of the [Arithmetic operators](arithmetic-operators.md) article. @@ -24,11 +24,11 @@ For information about the arithmetic `+` operator, see the [Unary plus and minus When one or both operands are of type [string](../builtin-types/reference-types.md#the-string-type), the `+` operator concatenates the string representations of its operands (the string representation of `null` is an empty string): -[!code-csharp-interactive[string concatenation](snippets/shared/AdditionOperator.cs#AddStrings)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/AdditionOperator.cs" id="AddStrings"::: [String interpolation](../tokens/interpolated.md) provides a more convenient way to format strings: -[!code-csharp-interactive[string interpolation](snippets/shared/AdditionOperator.cs#UseStringInterpolation)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/AdditionOperator.cs" id="UseStringInterpolation"::: You can use string interpolation to initialize a constant string when all the expressions used for placeholders are also constant strings. @@ -38,7 +38,7 @@ Beginning with C# 11, the `+` operator performs string concatenation for UTF-8 l For operands of the same [delegate](../builtin-types/reference-types.md#the-delegate-type) type, the `+` operator returns a new delegate instance that, when invoked, invokes the left-hand operand and then invokes the right-hand operand. If any of the operands is `null`, the `+` operator returns the value of another operand (which also might be `null`). The following example shows how delegates can be combined with the `+` operator: -[!code-csharp-interactive[delegate combination](snippets/shared/AdditionOperator.cs#AddDelegates)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/AdditionOperator.cs" id="AddDelegates"::: To perform delegate removal, use the [`-` operator](subtraction-operator.md#delegate-removal). @@ -62,17 +62,17 @@ Except that `x` is only evaluated once. The following example demonstrates the usage of the `+=` operator: -[!code-csharp-interactive[+= examples](snippets/shared/AdditionOperator.cs#AddAndAssign)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/AdditionOperator.cs" id="AddAndAssign"::: You also use the `+=` operator to specify an event handler method when you subscribe to an [event](../keywords/event.md). For more information, see [How to: subscribe to and unsubscribe from events](../../programming-guide/events/how-to-subscribe-to-and-unsubscribe-from-events.md). ## Operator overloadability -A user-defined type can [overload](operator-overloading.md) the `+` operator. When a binary `+` operator is overloaded, the `+=` operator is also implicitly overloaded. A user-defined type can't explicitly overload the `+=` operator. +A user-defined type can [overload](operator-overloading.md) the `+` operator. When a binary `+` operator is overloaded, the `+=` operator is also implicitly overloaded. Beginning with C# 14, a user-defined type can explicitly overload the `+=` operator to provide a more efficient implementation. Typically, a type overloads the `+=` operator because the value can be updated in place, rather than allocate a new instance to hold the result of the addition. If a type doesn't provide an explicit overload, the compiler generates the implicit overload. ## C# language specification -For more information, see the [Unary plus operator](~/_csharpstandard/standard/expressions.md#1292-unary-plus-operator) and [Addition operator](~/_csharpstandard/standard/expressions.md#12105-addition-operator) sections of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Unary plus operator](~/_csharpstandard/standard/expressions.md#1292-unary-plus-operator) and [Addition operator](~/_csharpstandard/standard/expressions.md#12105-addition-operator) sections of the [C# language specification](~/_csharpstandard/standard/README.md). For more information on overloading the compound assignment operators in C# 14 and later, see the [user defined compound assignment](~/_csharplang/proposals/user-defined-compound-assignment.md) feature specification. ## See also diff --git a/docs/csharp/language-reference/operators/arithmetic-operators.md b/docs/csharp/language-reference/operators/arithmetic-operators.md index a581621cff764..f90246855393b 100644 --- a/docs/csharp/language-reference/operators/arithmetic-operators.md +++ b/docs/csharp/language-reference/operators/arithmetic-operators.md @@ -1,7 +1,7 @@ --- title: "Arithmetic operators" description: "Learn about C# operators that perform multiplication, division, remainder, addition, and subtraction operations with numeric types." -ms.date: 07/25/2022 +ms.date: 06/11/2025 author: pkulikov f1_keywords: - "++_CSharpKeyword" @@ -38,9 +38,9 @@ The following operators perform arithmetic operations with operands of numeric t - Unary [`++` (increment)](#increment-operator-), [`--` (decrement)](#decrement-operator---), [`+` (plus)](#unary-plus-and-minus-operators), and [`-` (minus)](#unary-plus-and-minus-operators) operators - Binary [`*` (multiplication)](#multiplication-operator-), [`/` (division)](#division-operator-), [`%` (remainder)](#remainder-operator-), [`+` (addition)](#addition-operator-), and [`-` (subtraction)](#subtraction-operator--) operators -Those operators are supported by all [integral](../builtin-types/integral-numeric-types.md) and [floating-point](../builtin-types/floating-point-numeric-types.md) numeric types. +All [integral](../builtin-types/integral-numeric-types.md) and [floating-point](../builtin-types/floating-point-numeric-types.md) numeric types support these operators. -In the case of integral types, those operators (except the `++` and `--` operators) are defined for the `int`, `uint`, `long`, and `ulong` types. When operands are of other integral types (`sbyte`, `byte`, `short`, `ushort`, or `char`), their values are converted to the `int` type, which is also the result type of an operation. When operands are of different integral or floating-point types, their values are converted to the closest containing type, if such a type exists. For more information, see the [Numeric promotions](~/_csharpstandard/standard/expressions.md#1247-numeric-promotions) section of the [C# language specification](~/_csharpstandard/standard/README.md). The `++` and `--` operators are defined for all integral and floating-point numeric types and the [char](../builtin-types/char.md) type. The result type of a [compound assignment expression](#compound-assignment) is the type of the left-hand operand. +The `int`, `uint`, `long`, and `ulong` types define all these operators. The other integral types (`sbyte`, `byte`, `short`, `ushort`, and `char`) define only the `++` and `--` operators. For other operators, when operands are of the integral types `sbyte`, `byte`, `short`, `ushort`, or `char`, their values are converted to the `int` type and the result type is `int`. When operands are of different integral or floating-point types, their values are converted to the closest containing type, if such a type exists. For more information, see the [Numeric promotions](~/_csharpstandard/standard/expressions.md#1247-numeric-promotions) section of the [C# language specification](~/_csharpstandard/standard/README.md). The `++` and `--` operators are defined for all integral and floating-point numeric types and the [char](../builtin-types/char.md) type. The result type of a [compound assignment expression](#compound-assignment) is the type of the left-hand operand. ## Increment operator ++ @@ -114,7 +114,7 @@ For the `float`, `double`, and `decimal` types, the result of the `/` operator i :::code language="csharp" interactive="try-dotnet-method" source="snippets/shared/ArithmeticOperators.cs" id="FloatingPointDivision"::: -If one of the operands is `decimal`, another operand can be neither `float` nor `double`, because neither `float` nor `double` is implicitly convertible to `decimal`. You must explicitly convert the `float` or `double` operand to the `decimal` type. For more information about conversions between numeric types, see [Built-in numeric conversions](../builtin-types/numeric-conversions.md). +If one of the operands is `decimal`, another operand can't be `float` nor `double`, because neither `float` nor `double` is implicitly convertible to `decimal`. You must explicitly convert the `float` or `double` operand to the `decimal` type. For more information about conversions between numeric types, see [Built-in numeric conversions](../builtin-types/numeric-conversions.md). ## Remainder operator % @@ -136,7 +136,7 @@ For the `float` and `double` operands, the result of `x % y` for the finite `x` - The absolute value of `z` is the value produced by `|x| - n * |y|` where `n` is the largest possible integer that is less than or equal to `|x| / |y|` and `|x|` and `|y|` are the absolute values of `x` and `y`, respectively. > [!NOTE] -> This method of computing the remainder is analogous to that used for integer operands, but different from the IEEE 754 specification. If you need the remainder operation that complies with the IEEE 754 specification, use the method. +> This method of computing the remainder is analogous to the method used for integer operands, but different from the IEEE 754 specification. If you need the remainder operation that complies with the IEEE 754 specification, use the method. For information about the behavior of the `%` operator with non-finite operands, see the [Remainder operator](~/_csharpstandard/standard/expressions.md#12104-remainder-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md). @@ -170,13 +170,13 @@ For a binary operator `op`, a compound assignment expression of the form x op= y ``` -is equivalent to +Is equivalent to ```csharp x = x op y ``` -except that `x` is only evaluated once. +Except that `x` is only evaluated once. The following example demonstrates the usage of compound assignment with arithmetic operators: @@ -247,7 +247,7 @@ For more information, see remarks at the [System.Double](/dotnet/api/system.doub ## Operator overloadability -A user-defined type can [overload](operator-overloading.md) the unary (`++`, `--`, `+`, and `-`) and binary (`*`, `/`, `%`, `+`, and `-`) arithmetic operators. When a binary operator is overloaded, the corresponding compound assignment operator is also implicitly overloaded. A user-defined type can't explicitly overload a compound assignment operator. +A user-defined type can [overload](operator-overloading.md) the unary (`++`, `--`, `+`, and `-`) and binary (`*`, `/`, `%`, `+`, and `-`) arithmetic operators. When a binary operator is overloaded, the corresponding compound assignment operator is also implicitly overloaded. Beginning with C# 14, a user-defined type can explicitly overload the compound assignment operators (`op=`) to provide a more efficient implementation. Typically, a type overloads these operators because the value can be updated in place, rather than allocating a new instance to store the result of the operation. If a type doesn't provide an explicit overload, the compiler generates the implicit overload. ### User-defined checked operators @@ -268,10 +268,11 @@ You can use the `checked` modifier only when you overload any of the following o - Unary `++`, `--`, and `-` operators - Binary `*`, `/`, `+`, and `-` operators +- Compound assignment `*=`, `/=`, `+=`, and `-=` operators (C# 14 and later) - [Explicit conversion operators](user-defined-conversion-operators.md) > [!NOTE] -> The overflow-checking context within the body of a checked operator is not affected by the presence of the `checked` modifier. The default context is defined by the value of the [**CheckForOverflowUnderflow**](../compiler-options/language.md#checkforoverflowunderflow) compiler option. Use the [`checked` and `unchecked` statements](../statements/checked-and-unchecked.md) to explicitly specify the overflow-checking context, as the example at the beginning of this section demonstrates. +> The overflow-checking context within the body of a checked operator isn't affected by the presence of the `checked` modifier. The default context is defined by the value of the [**CheckForOverflowUnderflow**](../compiler-options/language.md#checkforoverflowunderflow) compiler option. Use the [`checked` and `unchecked` statements](../statements/checked-and-unchecked.md) to explicitly specify the overflow-checking context, as the example at the beginning of this section demonstrates. ## C# language specification @@ -289,6 +290,7 @@ For more information, see the following sections of the [C# language specificati - [Compound assignment](~/_csharpstandard/standard/expressions.md#12214-compound-assignment) - [The checked and unchecked operators](~/_csharpstandard/standard/expressions.md#12820-the-checked-and-unchecked-operators) - [Numeric promotions](~/_csharpstandard/standard/expressions.md#1247-numeric-promotions) +- [User defined compound assignment](~/_csharplang/proposals/user-defined-compound-assignment.md) ## See also diff --git a/docs/csharp/language-reference/operators/assignment-operator.md b/docs/csharp/language-reference/operators/assignment-operator.md index 86471b7b47e28..db8f86ff5bd12 100644 --- a/docs/csharp/language-reference/operators/assignment-operator.md +++ b/docs/csharp/language-reference/operators/assignment-operator.md @@ -1,7 +1,7 @@ --- title: "Assignment operators - assign an expression to a variable" description: "C# Assignment sets the value of the expression. Alternatively, `ref` assignment sets the reference of a reference variable." -ms.date: 04/04/2025 +ms.date: 06/11/2025 f1_keywords: - "=_CSharpKeyword" helpviewer_keywords: @@ -77,11 +77,11 @@ You can use the null-coalescing assignment operator `??=` to assign the value of A user-defined type can't [overload](operator-overloading.md) the assignment operator. However, a user-defined type can define an implicit conversion to another type. That way, the value of a user-defined type can be assigned to a variable, a property, or an indexer element of another type. For more information, see [User-defined conversion operators](user-defined-conversion-operators.md). -A user-defined type can't explicitly overload a compound assignment operator. However, if a user-defined type overloads a binary operator `op`, the `op=` operator, if it exists, is also implicitly overloaded. +If a user-defined type overloads a binary operator `op`, the `op=` operator, if it exists, is also implicitly overloaded. Beginning with C# 14, a user-defined type can explicitly overload the compound assignment operators (`op=`) to provide a more efficient implementation. Typically, a type overloads these operators because the value can be updated in place, rather than allocating a new instance to hold the result of the binary operation. If a type doesn't provide an explicit overload, the compiler generates the implicit overload. ## C# language specification -For more information, see the [Assignment operators](~/_csharpstandard/standard/expressions.md#1221-assignment-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Assignment operators](~/_csharpstandard/standard/expressions.md#1221-assignment-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md) and the [User defined compound assignment](~/_csharplang/proposals/user-defined-compound-assignment.md) feature specification. ## See also diff --git a/docs/csharp/language-reference/operators/bitwise-and-shift-operators.md b/docs/csharp/language-reference/operators/bitwise-and-shift-operators.md index 9fbef850bb76a..3a8151e71719b 100644 --- a/docs/csharp/language-reference/operators/bitwise-and-shift-operators.md +++ b/docs/csharp/language-reference/operators/bitwise-and-shift-operators.md @@ -1,7 +1,7 @@ --- title: "Bitwise and shift operators - perform boolean (AND, NOT, OR, XOR) and shift operations on individual bits in integral types" -description: "Learn about C# operators that perform bitwise logical (AND - `&`, NOT - `~`, OR - `|`, XOR - `^`) or shift operations( `<<`, and `>>`) with operands of integral types. " -ms.date: 11/29/2022 +description: "Learn about C# operators that perform bitwise logical (AND - `&`, NOT - `~`, OR - `|`, XOR - `^`) or shift operations(`<<`, and `>>`) with operands of integral types. " +ms.date: 06/11/2025 author: pkulikov f1_keywords: - "~_CSharpKeyword" @@ -89,7 +89,7 @@ The high-order empty bit positions are set based on the type of the left-hand op :::code language="csharp" interactive="try-dotnet-method" source="snippets/shared/BitwiseAndShiftOperators.cs" id="LogicalRightShift"::: > [!NOTE] -> Use the [unsigned right-shift operator](#unsigned-right-shift-operator-) to perform a *logical* shift on operands of signed integer types. This is preferred to casting a left-hand operand to an unsigned type and then casting the result of a shift operation back to a signed type. +> Use the [unsigned right-shift operator](#unsigned-right-shift-operator-) to perform a *logical* shift on operands of signed integer types. The logical shift is preferred to casting a left-hand operand to an unsigned type and then casting the result of a shift operation back to a signed type. ## Unsigned right-shift operator >>> @@ -131,13 +131,13 @@ For a binary operator `op`, a compound assignment expression of the form x op= y ``` -is equivalent to +Is equivalent to ```csharp x = x op y ``` -except that `x` is only evaluated once. +Except that `x` is only evaluated once. The following example demonstrates the usage of compound assignment with bitwise and shift operators: @@ -167,9 +167,9 @@ For the complete list of C# operators ordered by precedence level, see the [Oper For the `x << count`, `x >> count`, and `x >>> count` expressions, the actual shift count depends on the type of `x` as follows: -- If the type of `x` is `int` or `uint`, the shift count is defined by the low-order *five* bits of the right-hand operand. That is, the shift count is computed from `count & 0x1F` (or `count & 0b_1_1111`). +- If the type of `x` is `int` or `uint`, the low-order *five* bits of the right-hand operand define the shift count. That is, the shift count is computed from `count & 0x1F` (or `count & 0b_1_1111`). -- If the type of `x` is `long` or `ulong`, the shift count is defined by the low-order *six* bits of the right-hand operand. That is, the shift count is computed from `count & 0x3F` (or `count & 0b_11_1111`). +- If the type of `x` is `long` or `ulong`, the low-order *six* bits of the right-hand operand define the shift count. That is, the shift count is computed from `count & 0x3F` (or `count & 0b_11_1111`). The following example demonstrates that behavior: @@ -180,13 +180,13 @@ The following example demonstrates that behavior: ## Enumeration logical operators -The `~`, `&`, `|`, and `^` operators are also supported by any [enumeration](../builtin-types/enum.md) type. For operands of the same enumeration type, a logical operation is performed on the corresponding values of the underlying integral type. For example, for any `x` and `y` of an enumeration type `T` with an underlying type `U`, the `x & y` expression produces the same result as the `(T)((U)x & (U)y)` expression. +Every [enumeration](../builtin-types/enum.md) type supports the `~`, `&`, `|`, and `^` operators. For operands of the same enumeration type, a logical operation is performed on the corresponding values of the underlying integral type. For example, for any `x` and `y` of an enumeration type `T` with an underlying type `U`, the `x & y` expression produces the same result as the `(T)((U)x & (U)y)` expression. You typically use bitwise logical operators with an enumeration type that is defined with the [Flags](xref:System.FlagsAttribute) attribute. For more information, see the [Enumeration types as bit flags](../builtin-types/enum.md#enumeration-types-as-bit-flags) section of the [Enumeration types](../builtin-types/enum.md) article. ## Operator overloadability -A user-defined type can [overload](operator-overloading.md) the `~`, `<<`, `>>`, `>>>`, `&`, `|`, and `^` operators. When a binary operator is overloaded, the corresponding compound assignment operator is also implicitly overloaded. A user-defined type can't explicitly overload a compound assignment operator. +A user-defined type can [overload](operator-overloading.md) the `~`, `<<`, `>>`, `>>>`, `&`, `|`, and `^` operators. When a binary operator is overloaded, the corresponding compound assignment operator is also implicitly overloaded. Beginning with C# 14, a user-defined type can explicitly overload the compound assignment operators to provide a more efficient implementation. Typically, a type overloads these operators because the value can be updated in place, rather than allocating a new instance to store the result of the binary operation. If a type doesn't provide an explicit overload, the compiler generates the implicit overload. If a user-defined type `T` overloads the `<<`, `>>`, or `>>>` operator, the type of the left-hand operand must be `T`. In C# 10 and earlier, the type of the right-hand operand must be `int`; beginning with C# 11, the type of the right-hand operand of an overloaded shift operator can be any. @@ -201,6 +201,7 @@ For more information, see the following sections of the [C# language specificati - [Numeric promotions](~/_csharpstandard/standard/expressions.md#1247-numeric-promotions) - [C# 11 - Relaxed shift requirements](~/_csharplang/proposals/csharp-11.0/relaxing_shift_operator_requirements.md) - [C# 11 - Logical right-shift operator](~/_csharplang/proposals/csharp-11.0/unsigned-right-shift-operator.md) +- [User defined compound assignment](~/_csharplang/proposals/user-defined-compound-assignment.md) ## See also diff --git a/docs/csharp/language-reference/operators/boolean-logical-operators.md b/docs/csharp/language-reference/operators/boolean-logical-operators.md index 3c4a0031a18d6..7360d387a25af 100644 --- a/docs/csharp/language-reference/operators/boolean-logical-operators.md +++ b/docs/csharp/language-reference/operators/boolean-logical-operators.md @@ -1,7 +1,7 @@ --- title: "Boolean logical operators - the boolean and, or, not, and xor operators" description: "C# logical operators perform logical negation (`!`), conjunction (AND - `&`, `&&`), and inclusive and exclusive disjunction (OR - `|`, `||`, `^`) operations with Boolean operands." -ms.date: 11/29/2022 +ms.date: 06/10/2025 author: pkulikov f1_keywords: - "!_CSharpKeyword" @@ -50,7 +50,7 @@ For operands of the [integral numeric types](../builtin-types/integral-numeric-t The unary prefix `!` operator computes logical negation of its operand. That is, it produces `true`, if the operand evaluates to `false`, and `false`, if the operand evaluates to `true`: -[!code-csharp-interactive[logical negation](snippets/shared/BooleanLogicalOperators.cs#Negation)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/BooleanLogicalOperators.cs" id="Negation"::: The unary postfix `!` operator is the [null-forgiving operator](null-forgiving.md). @@ -62,7 +62,7 @@ The `&` operator always evaluates both operands. When the left-hand operand eval In the following example, the right-hand operand of the `&` operator is a method call, which is performed regardless of the value of the left-hand operand: -[!code-csharp-interactive[logical AND](snippets/shared/BooleanLogicalOperators.cs#And)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/BooleanLogicalOperators.cs" id="And"::: The [conditional logical AND operator](#conditional-logical-and-operator-) `&&` also computes the logical AND of its operands, but doesn't evaluate the right-hand operand if the left-hand operand evaluates to `false`. @@ -72,7 +72,7 @@ For operands of the [integral numeric types](../builtin-types/integral-numeric-t The `^` operator computes the logical exclusive OR, also known as the logical XOR, of its operands. The result of `x ^ y` is `true` if `x` evaluates to `true` and `y` evaluates to `false`, or `x` evaluates to `false` and `y` evaluates to `true`. Otherwise, the result is `false`. That is, for the `bool` operands, the `^` operator computes the same result as the [inequality operator](equality-operators.md#inequality-operator-) `!=`. -[!code-csharp-interactive[logical exclusive OR](snippets/shared/BooleanLogicalOperators.cs#Xor)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/BooleanLogicalOperators.cs" id="Xor"::: For operands of the [integral numeric types](../builtin-types/integral-numeric-types.md), the `^` operator computes the [bitwise logical exclusive OR](bitwise-and-shift-operators.md#logical-exclusive-or-operator-) of its operands. @@ -84,7 +84,7 @@ The `|` operator always evaluates both operands. When the left-hand operand eval In the following example, the right-hand operand of the `|` operator is a method call, which is performed regardless of the value of the left-hand operand: -[!code-csharp-interactive[logical OR](snippets/shared/BooleanLogicalOperators.cs#Or)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/BooleanLogicalOperators.cs" id="Or"::: The [conditional logical OR operator](#conditional-logical-or-operator-) `||` also computes the logical OR of its operands, but doesn't evaluate the right-hand operand if the left-hand operand evaluates to `true`. @@ -96,7 +96,7 @@ The conditional logical AND operator `&&`, also known as the "short-circuiting" In the following example, the right-hand operand of the `&&` operator is a method call, which isn't performed if the left-hand operand evaluates to `false`: -[!code-csharp-interactive[conditional logical AND](snippets/shared/BooleanLogicalOperators.cs#ConditionalAnd)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/BooleanLogicalOperators.cs" id="ConditionalAnd"::: The [logical AND operator](#logical-and-operator-) `&` also computes the logical AND of its operands, but always evaluates both operands. @@ -106,7 +106,7 @@ The conditional logical OR operator `||`, also known as the "short-circuiting" l In the following example, the right-hand operand of the `||` operator is a method call, which isn't performed if the left-hand operand evaluates to `true`: -[!code-csharp-interactive[conditional logical OR](snippets/shared/BooleanLogicalOperators.cs#ConditionalOr)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/BooleanLogicalOperators.cs" id="ConditionalOr"::: The [logical OR operator](#logical-or-operator-) `|` also computes the logical OR of its operands, but always evaluates both operands. @@ -120,23 +120,23 @@ For `bool?` operands, the [`&` (logical AND)](#logical-and-operator-) and [`|` ( The following table presents that semantics: -|x|y|x&y|x|y| -|----|----|----|----| -|true|true|true|true| -|true|false|false|true| -|true|null|null|true| -|false|true|false|true| -|false|false|false|false| -|false|null|false|null| -|null|true|null|true| -|null|false|false|null| -|null|null|null|null| +| x | y | x & y | x \| y | +|-------|-------|-------|----------| +| true | true | true | true | +| true | false | false | true | +| true | null | null | true | +| false | true | false | true | +| false | false | false | false | +| false | null | false | null | +| null | true | null | true | +| null | false | false | null | +| null | null | null | null | The behavior of those operators differs from the typical operator behavior with nullable value types. Typically, an operator that is defined for operands of a value type can be also used with operands of the corresponding nullable value type. Such an operator produces `null` if any of its operands evaluates to `null`. However, the `&` and `|` operators can produce non-null even if one of the operands evaluates to `null`. For more information about the operator behavior with nullable value types, see the [Lifted operators](../builtin-types/nullable-value-types.md#lifted-operators) section of the [Nullable value types](../builtin-types/nullable-value-types.md) article. You can also use the `!` and `^` operators with `bool?` operands, as the following example shows: -[!code-csharp-interactive[lifted negation and xor](snippets/shared/BooleanLogicalOperators.cs#WithNullableBoolean)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/BooleanLogicalOperators.cs" id="WithNullableBoolean"::: The conditional logical operators `&&` and `||` don't support `bool?` operands. @@ -148,17 +148,17 @@ For a binary operator `op`, a compound assignment expression of the form x op= y ``` -is equivalent to +Is equivalent to ```csharp x = x op y ``` -except that `x` is only evaluated once. +Except that `x` is only evaluated once. The `&`, `|`, and `^` operators support compound assignment, as the following example shows: -[!code-csharp-interactive[compound assignment](snippets/shared/BooleanLogicalOperators.cs#CompoundAssignment)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/BooleanLogicalOperators.cs" id="CompoundAssignment"::: > [!NOTE] > The conditional logical operators `&&` and `||` don't support compound assignment. @@ -176,13 +176,13 @@ The following list orders logical operators starting from the highest precedence Use parentheses, `()`, to change the order of evaluation imposed by operator precedence: -[!code-csharp-interactive[operator precedence](snippets/shared/BooleanLogicalOperators.cs#Precedence)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/BooleanLogicalOperators.cs" id="Precedence"::: For the complete list of C# operators ordered by precedence level, see the [Operator precedence](index.md#operator-precedence) section of the [C# operators](index.md) article. ## Operator overloadability -A user-defined type can [overload](operator-overloading.md) the `!`, `&`, `|`, and `^` operators. When a binary operator is overloaded, the corresponding compound assignment operator is also implicitly overloaded. A user-defined type can't explicitly overload a compound assignment operator. +A user-defined type can [overload](operator-overloading.md) the `!`, `&`, `|`, and `^` operators. When a binary operator is overloaded, the corresponding compound assignment operator is also implicitly overloaded. Beginning with C# 14, a user-defined type can explicitly overload the compound assignment operators to provide a more efficient implementation. Typically, a type overloads these operators because the value can be updated in place, rather than allocating a new instance to hold the result of the binary operation. If a type doesn't provide an explicit overload, the compiler generates the implicit overload. A user-defined type can't overload the conditional logical operators `&&` and `||`. However, if a user-defined type overloads the [true and false operators](true-false-operators.md) and the `&` or `|` operator in a certain way, the `&&` or `||` operation, respectively, can be evaluated for the operands of that type. For more information, see the [User-defined conditional logical operators](~/_csharpstandard/standard/expressions.md#12143-user-defined-conditional-logical-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). @@ -194,6 +194,7 @@ For more information, see the following sections of the [C# language specificati - [Logical operators](~/_csharpstandard/standard/expressions.md#1213-logical-operators) - [Conditional logical operators](~/_csharpstandard/standard/expressions.md#1214-conditional-logical-operators) - [Compound assignment](~/_csharpstandard/standard/expressions.md#12214-compound-assignment) +- [User defined compound assignment](~/_csharplang/proposals/user-defined-compound-assignment.md) ## See also diff --git a/docs/csharp/language-reference/operators/operator-overloading.md b/docs/csharp/language-reference/operators/operator-overloading.md index 98a9375f0cffa..2e411016eb6af 100644 --- a/docs/csharp/language-reference/operators/operator-overloading.md +++ b/docs/csharp/language-reference/operators/operator-overloading.md @@ -1,7 +1,7 @@ --- title: "Operator overloading - Define unary, arithmetic, equality, and comparison operators." -description: "Learn how to overload a C# operator and which C# operators are overloadable. In general, the unary, arithmetic, equality and comparison operators are overloadable." -ms.date: 11/28/2022 +description: "Learn how to overload a C# operator and which C# operators are overloadable. In general, the unary, arithmetic, equality, and comparison operators are overloadable." +ms.date: 06/11/2025 f1_keywords: - "operator_CSharpKeyword" - operator @@ -9,18 +9,20 @@ helpviewer_keywords: - "operator keyword [C#]" - "operator overloading [C#]" --- -# Operator overloading - predefined unary, arithmetic, equality and comparison operators +# Operator overloading - predefined unary, arithmetic, equality, and comparison operators A user-defined type can overload a predefined C# operator. That is, a type can provide the custom implementation of an operation in case one or both of the operands are of that type. The [Overloadable operators](#overloadable-operators) section shows which C# operators can be overloaded. Use the `operator` keyword to declare an operator. An operator declaration must satisfy the following rules: -- It includes both a `public` and a `static` modifier. +- It includes a `public` modifier. - A unary operator has one input parameter. A binary operator has two input parameters. In each case, at least one parameter must have type `T` or `T?` where `T` is the type that contains the operator declaration. +- It includes the `static` modifier, except for the compound assignment operators, such as `+=`. +- The increment (`++`) and decrement (`--`) operators can be implemented as either static or instance methods. The following example defines a simplified structure to represent a rational number. The structure overloads some of the [arithmetic operators](arithmetic-operators.md): -[!code-csharp[fraction example](snippets/shared/OperatorOverloading.cs)] +:::code language="csharp" source="snippets/shared/OperatorOverloading.cs"::: You could extend the preceding example by [defining an implicit conversion](user-defined-conversion-operators.md) from `int` to `Fraction`. Then, overloaded operators would support arguments of those two types. That is, it would become possible to add an integer to a fraction and obtain a fraction as a result. @@ -35,6 +37,21 @@ The following table shows the operators that can be overloaded: |[`+x`](arithmetic-operators.md#unary-plus-and-minus-operators), [`-x`](arithmetic-operators.md#unary-plus-and-minus-operators), [`!x`](boolean-logical-operators.md#logical-negation-operator-), [`~x`](bitwise-and-shift-operators.md#bitwise-complement-operator-), [`++`](arithmetic-operators.md#increment-operator-), [`--`](arithmetic-operators.md#decrement-operator---), [`true`](true-false-operators.md), [`false`](true-false-operators.md)|The `true` and `false` operators must be overloaded together.| |[`x + y`](arithmetic-operators.md#addition-operator-), [`x - y`](arithmetic-operators.md#subtraction-operator--), [`x * y`](arithmetic-operators.md#multiplication-operator-), [`x / y`](arithmetic-operators.md#division-operator-), [`x % y`](arithmetic-operators.md#remainder-operator-),
[`x & y`](boolean-logical-operators.md#logical-and-operator-), [x | y](boolean-logical-operators.md#logical-or-operator-), [`x ^ y`](boolean-logical-operators.md#logical-exclusive-or-operator-),
[`x << y`](bitwise-and-shift-operators.md#left-shift-operator-), [`x >> y`](bitwise-and-shift-operators.md#right-shift-operator-), [`x >>> y`](bitwise-and-shift-operators.md#unsigned-right-shift-operator-) | | |[`x == y`](equality-operators.md#equality-operator-), [`x != y`](equality-operators.md#inequality-operator-), [`x < y`](comparison-operators.md#less-than-operator-), [`x > y`](comparison-operators.md#greater-than-operator-), [`x <= y`](comparison-operators.md#less-than-or-equal-operator-), [`x >= y`](comparison-operators.md#greater-than-or-equal-operator-)|Must be overloaded in pairs as follows: `==` and `!=`, `<` and `>`, `<=` and `>=`.| +|[`+=`](arithmetic-operators.md#compound-assignment), [`-=`](arithmetic-operators.md#compound-assignment), [`*=`](arithmetic-operators.md#compound-assignment), [`/=`](arithmetic-operators.md#compound-assignment), [`%=`](arithmetic-operators.md#compound-assignment), [`&=`](boolean-logical-operators.md#compound-assignment), [`\|=`](boolean-logical-operators.md#compound-assignment), [`^=`](boolean-logical-operators.md#compound-assignment), [`<<=`](bitwise-and-shift-operators.md#compound-assignment), [`>>=`](bitwise-and-shift-operators.md#compound-assignment), [`>>>=`](bitwise-and-shift-operators.md#compound-assignment)|The compound assignment operators can be overloaded in C# 14 and later.| + +A compound assignment overloaded operator must follow these rules: + +- It must include the `public` modifier. +- It can't include the `static` modifier. +- The return type must be `void`. +- The declaration must include one parameter, which represents the right hand side of the compound assignment. + +Beginning with C# 14, the increment (`++`) and decrement (`--`) operators can be overloaded as instance members. Instance operators can improve performance by avoiding the creation of a new instance. An instance operator must follow these rules: + +- It must include the `public` modifier. +- It can't include the `static` modifier. +- The return type must be `void`. +- It can't declare any parameters, even if those parameters have a default value. ## Non overloadable operators @@ -44,10 +61,29 @@ The following table shows the operators that can't be overloaded: | :---------: | --------------- | |[`x && y`](boolean-logical-operators.md#conditional-logical-and-operator-), [x || y](boolean-logical-operators.md#conditional-logical-or-operator-)| Overload both the [`true`](true-false-operators.md) and [`false`](true-false-operators.md) operators and the [`&`](boolean-logical-operators.md#logical-and-operator-) or [|](boolean-logical-operators.md#logical-or-operator-) operators. For more information, see [User-defined conditional logical operators](~/_csharpstandard/standard/expressions.md#12143-user-defined-conditional-logical-operators).| |[a[i]](member-access-operators.md#indexer-operator-), [`a?[i]`](member-access-operators.md#null-conditional-operators--and-)|Define an [indexer](../../programming-guide/indexers/index.md).| -|[`(T)x`](type-testing-and-cast.md#cast-expression)|Define custom type conversions that can be performed by a cast expression. For more information, see [User-defined conversion operators](user-defined-conversion-operators.md).| -|[`+=`](arithmetic-operators.md#compound-assignment), [`-=`](arithmetic-operators.md#compound-assignment), [`*=`](arithmetic-operators.md#compound-assignment), [`/=`](arithmetic-operators.md#compound-assignment), [`%=`](arithmetic-operators.md#compound-assignment), [`&=`](boolean-logical-operators.md#compound-assignment), [|=](boolean-logical-operators.md#compound-assignment), [`^=`](boolean-logical-operators.md#compound-assignment), [`<<=`](bitwise-and-shift-operators.md#compound-assignment), [`>>=`](bitwise-and-shift-operators.md#compound-assignment), [`>>>=`](bitwise-and-shift-operators.md#compound-assignment)|Overload the corresponding binary operator. For example, when you overload the binary `+` operator, `+=` is implicitly overloaded.| +|[`(T)x`](type-testing-and-cast.md#cast-expression)|Define custom type conversions performed by a cast expression. For more information, see [User-defined conversion operators](user-defined-conversion-operators.md).| |[`^x`](member-access-operators.md#index-from-end-operator-), [`x = y`](assignment-operator.md), [`x.y`](member-access-operators.md#member-access-expression-), [`x?.y`](member-access-operators.md#null-conditional-operators--and-), [`c ? t : f`](conditional-operator.md), [`x ?? y`](null-coalescing-operator.md), [`??= y`](null-coalescing-operator.md),
[`x..y`](member-access-operators.md#range-operator-), [`x->y`](pointer-related-operators.md#pointer-member-access-operator--), [`=>`](lambda-operator.md), [`f(x)`](member-access-operators.md#invocation-expression-), [`as`](type-testing-and-cast.md#the-as-operator), [`await`](await.md), [`checked`](../statements/checked-and-unchecked.md), [`unchecked`](../statements/checked-and-unchecked.md), [`default`](default.md), [`delegate`](delegate-operator.md), [`is`](type-testing-and-cast.md#the-is-operator), [`nameof`](nameof.md), [`new`](new-operator.md),
[`sizeof`](sizeof.md), [`stackalloc`](stackalloc.md), [`switch`](switch-expression.md), [`typeof`](type-testing-and-cast.md#the-typeof-operator), [`with`](with-expression.md)|None.| +Before C# 14, the compound operators can't be overloaded. Overloading the corresponding binary operator implicitly overloads the corresponding compound assignment operator. + +## Operator overload resolution + +> [!IMPORTANT] +> This section applies to C# 14 and later. Before C# 14, user-defined compound assignment operators and instance increment and decrement operators aren't allowed. + +If `x` is classified as a variable in a compound assignment expression such as `x «op»= y`, instance operators are preferred over any static operator for `«op»`. If an overloaded `«op»=` operator isn't declared for the type of `x` or `x` isn't classified as a variable, the static operators are used. + +For the postfix operator `++`, if `x` isn't classified as a variable *or* the expression `x++` is used, the instance `operator++` is ignored. Otherwise, preference is given to the instance `operator ++`. For example, + +```csharp +x++; // Instance operator++ preferred. +y = x++; // instance operator++ isn't considered. +``` + +The reason for this rule is that `y` should be assigned to the value of `x` *before* it's incremented. The compiler can't determine that for a user-defined implementation in a reference type. + +For the prefix operator `++`, if `x` is classified as a variable in `++x`, the instance operator is preferred over a static unary operator. + ## C# language specification For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md): diff --git a/docs/csharp/language-reference/operators/snippets/shared/OperatorOverloading.cs b/docs/csharp/language-reference/operators/snippets/shared/OperatorOverloading.cs index 791b7770f0230..643b2cbab8f03 100644 --- a/docs/csharp/language-reference/operators/snippets/shared/OperatorOverloading.cs +++ b/docs/csharp/language-reference/operators/snippets/shared/OperatorOverloading.cs @@ -1,7 +1,7 @@ -public readonly struct Fraction +public struct Fraction { - private readonly int num; - private readonly int den; + private int numerator; + private int denominator; public Fraction(int numerator, int denominator) { @@ -9,32 +9,78 @@ public Fraction(int numerator, int denominator) { throw new ArgumentException("Denominator cannot be zero.", nameof(denominator)); } - num = numerator; - den = denominator; + this.numerator = numerator; + this.denominator = denominator; } - public static Fraction operator +(Fraction a) => a; - public static Fraction operator -(Fraction a) => new Fraction(-a.num, a.den); + public static Fraction operator +(Fraction operand) => operand; + public static Fraction operator -(Fraction operand) => new Fraction(-operand.numerator, operand.denominator); - public static Fraction operator +(Fraction a, Fraction b) - => new Fraction(a.num * b.den + b.num * a.den, a.den * b.den); + public static Fraction operator +(Fraction left, Fraction right) + => new Fraction(left.numerator * right.denominator + right.numerator * left.denominator, left.denominator * right.denominator); - public static Fraction operator -(Fraction a, Fraction b) - => a + (-b); + public static Fraction operator -(Fraction left, Fraction right) + => left + (-right); - public static Fraction operator *(Fraction a, Fraction b) - => new Fraction(a.num * b.num, a.den * b.den); + public static Fraction operator *(Fraction left, Fraction right) + => new Fraction(left.numerator * right.numerator, left.denominator * right.denominator); - public static Fraction operator /(Fraction a, Fraction b) + public static Fraction operator /(Fraction left, Fraction right) { - if (b.num == 0) + if (right.numerator == 0) { throw new DivideByZeroException(); } - return new Fraction(a.num * b.den, a.den * b.num); + return new Fraction(left.numerator * right.denominator, left.denominator * right.numerator); } - public override string ToString() => $"{num} / {den}"; + // Define increment and decrement to add 1/den, rather than 1/1. + public static Fraction operator ++(Fraction operand) + => new Fraction(operand.numerator++, operand.denominator); + + public static Fraction operator --(Fraction operand) => + new Fraction(operand.numerator--, operand.denominator); + + public override string ToString() => $"{numerator} / {denominator}"; + + // New operators allowed in C# 14: + public void operator +=(Fraction operand) => + (numerator, denominator ) = + ( + numerator * operand.denominator + operand.numerator * denominator, + denominator * operand.denominator + ); + + public void operator -=(Fraction operand) => + (numerator, denominator) = + ( + numerator * operand.denominator - operand.numerator * denominator, + denominator * operand.denominator + ); + + public void operator *=(Fraction operand) => + (numerator, denominator) = + ( + numerator * operand.numerator, + denominator * operand.denominator + ); + + public void operator /=(Fraction operand) + { + if (operand.numerator == 0) + { + throw new DivideByZeroException(); + } + (numerator, denominator) = + ( + numerator * operand.denominator, + denominator * operand.numerator + ); + } + + public void operator ++() => numerator++; + + public void operator --() => numerator--; } public static class OperatorOverloading diff --git a/docs/csharp/language-reference/operators/subtraction-operator.md b/docs/csharp/language-reference/operators/subtraction-operator.md index 305e9357d1f9c..05d1743fe688d 100644 --- a/docs/csharp/language-reference/operators/subtraction-operator.md +++ b/docs/csharp/language-reference/operators/subtraction-operator.md @@ -1,7 +1,7 @@ --- title: "- and -= operators - subtraction (minus) operators" description: "Learn about the C# subtraction (minus) operator and how it works with operands of numeric or delegate types." -ms.date: 11/28/2022 +ms.date: 06/11/2025 f1_keywords: - "-_CSharpKeyword" - "-=_CSharpKeyword" @@ -15,7 +15,7 @@ helpviewer_keywords: --- # - and -= operators - subtraction (minus) -The `-` and `-=` operators are supported by the built-in [integral](../builtin-types/integral-numeric-types.md) and [floating-point](../builtin-types/floating-point-numeric-types.md) numeric types and [delegate](../builtin-types/reference-types.md#the-delegate-type) types. +The built-in [integral](../builtin-types/integral-numeric-types.md) and [floating-point](../builtin-types/floating-point-numeric-types.md) numeric types and [delegate](../builtin-types/reference-types.md#the-delegate-type) types all support the `-` and `-=` operators. For information about the arithmetic `-` operator, see the [Unary plus and minus operators](arithmetic-operators.md#unary-plus-and-minus-operators) and [Subtraction operator -](arithmetic-operators.md#subtraction-operator--) sections of the [Arithmetic operators](arithmetic-operators.md) article. @@ -25,17 +25,17 @@ For operands of the same [delegate](../builtin-types/reference-types.md#the-dele - If both operands are non-null and the invocation list of the right-hand operand is a proper contiguous sublist of the invocation list of the left-hand operand, the result of the operation is a new invocation list that is obtained by removing the right-hand operand's entries from the invocation list of the left-hand operand. If the right-hand operand's list matches multiple contiguous sublists in the left-hand operand's list, only the right-most matching sublist is removed. If removal results in an empty list, the result is `null`. - [!code-csharp-interactive[delegate removal](snippets/shared/SubtractionOperator.cs#DelegateRemoval)] + :::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/SubtractionOperator.cs" id="DelegateRemoval"::: - If the invocation list of the right-hand operand isn't a proper contiguous sublist of the invocation list of the left-hand operand, the result of the operation is the left-hand operand. For example, removing a delegate that isn't part of the multicast delegate does nothing and results in the unchanged multicast delegate. - [!code-csharp-interactive[delegate removal with no effect](snippets/shared/SubtractionOperator.cs#DelegateRemovalNoChange)] + :::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/SubtractionOperator.cs" id="DelegateRemovalNoChange"::: The preceding example also demonstrates that during delegate removal delegate instances are compared. For example, delegates that are produced from evaluation of identical [lambda expressions](lambda-expressions.md) aren't equal. For more information about delegate equality, see the [Delegate equality operators](~/_csharpstandard/standard/expressions.md#12129-delegate-equality-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). - If the left-hand operand is `null`, the result of the operation is `null`. If the right-hand operand is `null`, the result of the operation is the left-hand operand. - [!code-csharp-interactive[delegate removal and null](snippets/shared/SubtractionOperator.cs#DelegateRemovalAndNull)] + :::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/SubtractionOperator.cs" id="DelegateRemovalAndNull"::: To combine delegates, use the [`+` operator](addition-operator.md#delegate-combination). @@ -49,27 +49,27 @@ An expression using the `-=` operator, such as x -= y ``` -is equivalent to +Is equivalent to ```csharp x = x - y ``` -except that `x` is only evaluated once. +Except that `x` is only evaluated once. The following example demonstrates the usage of the `-=` operator: -[!code-csharp-interactive[-= examples](snippets/shared/SubtractionOperator.cs#SubtractAndAssign)] +:::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/SubtractionOperator.cs" id="SubtractAndAssign"::: You also use the `-=` operator to specify an event handler method to remove when you unsubscribe from an [event](../keywords/event.md). For more information, see [How to subscribe to and unsubscribe from events](../../programming-guide/events/how-to-subscribe-to-and-unsubscribe-from-events.md). ## Operator overloadability -A user-defined type can [overload](operator-overloading.md) the `-` operator. When a binary `-` operator is overloaded, the `-=` operator is also implicitly overloaded. A user-defined type can't explicitly overload the `-=` operator. +A user-defined type can [overload](operator-overloading.md) the `-` operator. When a binary `-` operator is overloaded, the `-=` operator is also implicitly overloaded. Beginning with C# 14, a user-defined type can explicitly overload the `-=` operator to provide a more efficient implementation. Typically, a type overloads the `-=` operator because the value can be updated in place, rather than allocating a new instance to store the result of the subtraction. If a type doesn't provide an explicit overload, the compiler generates the implicit overload. ## C# language specification -For more information, see the [Unary minus operator](~/_csharpstandard/standard/expressions.md#1293-unary-minus-operator) and [Subtraction operator](~/_csharpstandard/standard/expressions.md#12106-subtraction-operator) sections of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Unary minus operator](~/_csharpstandard/standard/expressions.md#1293-unary-minus-operator) and [Subtraction operator](~/_csharpstandard/standard/expressions.md#12106-subtraction-operator) sections of the [C# language specification](~/_csharpstandard/standard/README.md). For more information on overloading the compound assignment operators in C# 14 and later, see the [user defined compound assignment](~/_csharplang/proposals/user-defined-compound-assignment.md) feature specification. ## See also diff --git a/docs/csharp/linq/standard-query-operators/projection-operations.md b/docs/csharp/linq/standard-query-operators/projection-operations.md index 388f423b460d1..c22cf8b9c569a 100644 --- a/docs/csharp/linq/standard-query-operators/projection-operations.md +++ b/docs/csharp/linq/standard-query-operators/projection-operations.md @@ -76,7 +76,7 @@ The third overload accepts a `Func` argument that acts :::code source="./snippets/standard-query-operators/SelectProjectionExamples.cs" id="ZipResultSelector"::: -With the preceding `Zip` overload, the specified function is applied to the corresponding elements `numbers` and `letter`, producing a sequence of the `string` results. +With the preceding `Zip` overload, the specified function is applied to the corresponding elements `number` and `letter`, producing a sequence of the `string` results. ## `Select` versus `SelectMany` diff --git a/docs/csharp/linq/standard-query-operators/snippets/standard-query-operators/ConversionExamples.cs b/docs/csharp/linq/standard-query-operators/snippets/standard-query-operators/ConversionExamples.cs index e03ba9d3a101d..6f050aeb8498f 100644 --- a/docs/csharp/linq/standard-query-operators/snippets/standard-query-operators/ConversionExamples.cs +++ b/docs/csharp/linq/standard-query-operators/snippets/standard-query-operators/ConversionExamples.cs @@ -17,7 +17,7 @@ private static void CastExampleQuery() // IEnumerable people = students; - var query = from Student student in students + var query = from Student student in people where student.Year == GradeLevel.ThirdYear select student; diff --git a/docs/csharp/linq/standard-query-operators/snippets/standard-query-operators/SelectProjectionExamples.cs b/docs/csharp/linq/standard-query-operators/snippets/standard-query-operators/SelectProjectionExamples.cs index f474cc10f34a0..c21808f681d5b 100644 --- a/docs/csharp/linq/standard-query-operators/snippets/standard-query-operators/SelectProjectionExamples.cs +++ b/docs/csharp/linq/standard-query-operators/snippets/standard-query-operators/SelectProjectionExamples.cs @@ -90,7 +90,7 @@ private static void SelectManyMethodSyntax() // List phrases = ["an apple a day", "the quick brown fox"]; - var query = phrases.SelectMany(phrases => phrases.Split(' ')); + var query = phrases.SelectMany(phrase => phrase.Split(' ')); foreach (string s in query) { diff --git a/docs/csharp/programming-guide/classes-and-structs/access-modifiers.md b/docs/csharp/programming-guide/classes-and-structs/access-modifiers.md index b3a3f8577cc5e..ed954559d7883 100644 --- a/docs/csharp/programming-guide/classes-and-structs/access-modifiers.md +++ b/docs/csharp/programming-guide/classes-and-structs/access-modifiers.md @@ -65,7 +65,7 @@ Normally, the accessibility of a member isn't greater than the accessibility of The type of any member field, property, or event must be at least as accessible as the member itself. Similarly, the return type and the parameter types of any method, indexer, or delegate must be at least as accessible as the member itself. For example, you can't have a `public` method `M` that returns a class `C` unless `C` is also `public`. Likewise, you can't have a `protected` property of type `A` if `A` is declared as `private`. -User-defined operators must always be declared as `public` and `static`. For more information, see [Operator overloading](../../language-reference/operators/operator-overloading.md). +User-defined operators must always be declared as `public`. For more information, see [Operator overloading](../../language-reference/operators/operator-overloading.md). To set the access level for a `class` or `struct` member, add the appropriate keyword to the member declaration, as shown in the following example. diff --git a/docs/csharp/programming-guide/classes-and-structs/members.md b/docs/csharp/programming-guide/classes-and-structs/members.md index 22e3f09fee178..cd537a3b63aea 100644 --- a/docs/csharp/programming-guide/classes-and-structs/members.md +++ b/docs/csharp/programming-guide/classes-and-structs/members.md @@ -20,7 +20,7 @@ Classes and structs have members that represent their data and behavior. A class |[Properties](./properties.md)|Properties are methods on a class that are accessed as if they were fields on that class. A property can provide protection for a class field to keep it from being changed without the knowledge of the object.| |[Methods](./methods.md)|Methods define the actions that a class can perform. Methods can take parameters that provide input data, and can return output data through parameters. Methods can also return a value directly, without using a parameter.| |[Events](../events/index.md)|Events provide notifications about occurrences, such as button clicks or the successful completion of a method, to other objects. Events are defined and triggered by using delegates.| -|[Operators](../../language-reference/operators/index.md)|Overloaded operators are considered type members. When you overload an operator, you define it as a public static method in a type. For more information, see [Operator overloading](../../language-reference/operators/operator-overloading.md).| +|[Operators](../../language-reference/operators/index.md)|Overloaded operators are considered type members. When you overload an operator, you define it as a public method in a type. For more information, see [Operator overloading](../../language-reference/operators/operator-overloading.md).| |[Indexers](../indexers/index.md)|Indexers enable an object to be indexed in a manner similar to arrays.| |[Constructors](./constructors.md)|Constructors are methods that are called when the object is first created. They are often used to initialize the data of an object.| |[Finalizers](./finalizers.md)|Finalizers are used very rarely in C#. They are methods that are called by the runtime execution engine when the object is about to be removed from memory. They are generally used to make sure that any resources which must be released are handled appropriately.| diff --git a/docs/csharp/programming-guide/concepts/iterators.md b/docs/csharp/programming-guide/concepts/iterators.md index 9dd939d0a9821..c7dd488d31b59 100644 --- a/docs/csharp/programming-guide/concepts/iterators.md +++ b/docs/csharp/programming-guide/concepts/iterators.md @@ -337,7 +337,7 @@ On each successive iteration of the `foreach` loop (or the direct call to `IEnum Iterators don't support the method. To reiterate from the start, you must obtain a new iterator. Calling on the iterator returned by an iterator method throws a . -For additional information, see the [C# Language Specification](~/_csharpstandard/standard/classes.md#1514-iterators). +For additional information, see the [C# Language Specification](~/_csharpstandard/standard/classes.md#1515-synchronous-and-asynchronous-iterators). ## Use of Iterators diff --git a/docs/csharp/specification/toc.yml b/docs/csharp/specification/toc.yml index 3b5d5fba4fb42..7c9a0759f63a9 100644 --- a/docs/csharp/specification/toc.yml +++ b/docs/csharp/specification/toc.yml @@ -135,8 +135,6 @@ items: items: - name: Ranges href: ../../../_csharplang/proposals/csharp-8.0/ranges.md - - name: Null coalescing assignment - href: ../../../_csharplang/proposals/csharp-8.0/null-coalescing-assignment.md - name: Target-typed new expressions href: ../../../_csharplang/proposals/csharp-9.0/target-typed-new.md - name: Target-typed conditional expression @@ -177,6 +175,8 @@ items: href: ../../../_csharplang/proposals/csharp-13.0/overload-resolution-priority.md - name: Null conditional assignment href: ../../../_csharplang/proposals/null-conditional-assignment.md + - name: User defined compound assignment operators + href: ../../../_csharplang/proposals/user-defined-compound-assignment.md - name: Statements items: - name: Global using directive @@ -187,8 +187,6 @@ items: href: ../../../_csharplang/proposals/csharp-9.0/local-function-attributes.md - name: Pattern based using and using declarations href: ../../../_csharplang/proposals/csharp-8.0/using.md - - name: Async streams - href: ../../../_csharplang/proposals/csharp-8.0/async-streams.md - name: Lock object semantics href: ../../../_csharplang/proposals/csharp-13.0/lock-object.md - name: Allow `ref` and `unsafe` diff --git a/docs/csharp/whats-new/csharp-14.md b/docs/csharp/whats-new/csharp-14.md index e2b817a7ac480..530dc57047d37 100644 --- a/docs/csharp/whats-new/csharp-14.md +++ b/docs/csharp/whats-new/csharp-14.md @@ -15,6 +15,7 @@ C# 14 includes the following new features. You can try these features using the - [Modifiers on simple lambda parameters](#simple-lambda-parameters-with-modifiers) - [`field` backed properties](#the-field-keyword) - [`partial` events and constructors](#more-partial-members) +- [user-defined compound assignment operators](#user-defined-compound-assignment) C# 14 is supported on **.NET 10**. For more information, see [C# language versioning](../language-reference/configure-language-version.md). @@ -136,6 +137,10 @@ Only the implementing declaration of a partial constructor can include a constru The implementing declaration of a partial event must include `add` and `remove` accessors. The defining declaration declares a field-like event. +## User defined compound assignment + +You can learn more in the feature specification for [user-defined compound assignment](~/_csharplang/proposals/user-defined-compound-assignment.md). + ## Null-conditional assignment The null-conditional member access operators, `?.` and `?[]`, can now be used on the left hand side of an assignment or compound assignment.