From 14d91fbf599b6ebb68aec39847aa00f630c57f80 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 29 May 2026 10:29:21 -0700 Subject: [PATCH 1/6] Update package index with latest published versions (#54095) --- docs/azure/includes/dotnet-all.md | 18 +++++++++--------- docs/azure/includes/dotnet-new.md | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index fee5c36fd6579..f998650007dd8 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -119,7 +119,7 @@ | Tables | NuGet [12.11.0](https://www.nuget.org/packages/Azure.Data.Tables/12.11.0) | [docs](/dotnet/api/overview/azure/Data.Tables-readme) | GitHub [12.11.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.Tables_12.11.0/sdk/tables/Azure.Data.Tables/) | | Text Analytics | NuGet [5.3.0](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.3.0) | [docs](/dotnet/api/overview/azure/AI.TextAnalytics-readme) | GitHub [5.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.3.0/sdk/textanalytics/Azure.AI.TextAnalytics/) | | Text Authoring | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Language.Text.Authoring/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Language.Text.Authoring-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.Language.Text.Authoring_1.0.0-beta.2/sdk/cognitivelanguage/Azure.AI.Language.Text.Authoring/) | -| Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Translation.Text/2.0.0-beta.1) | [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/)
GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_2.0.0-beta.1/sdk/translation/Azure.AI.Translation.Text/) | +| Text Translation | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/2.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_2.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.4](https://www.nuget.org/packages/Azure.AI.AgentServer.Invocations/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.AgentServer.Invocations-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Invocations_1.0.0-beta.4/sdk/agentserver/Azure.AI.AgentServer.Invocations/) | @@ -324,7 +324,7 @@ | Resource Management - Maintenance | NuGet [1.1.3](https://www.nuget.org/packages/Azure.ResourceManager.Maintenance/1.1.3)
NuGet [1.2.0-beta.10](https://www.nuget.org/packages/Azure.ResourceManager.Maintenance/1.2.0-beta.10) | [docs](/dotnet/api/overview/azure/ResourceManager.Maintenance-readme) | GitHub [1.1.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Maintenance_1.1.3/sdk/maintenance/Azure.ResourceManager.Maintenance/)
GitHub [1.2.0-beta.10](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Maintenance_1.2.0-beta.10/sdk/maintenance/Azure.ResourceManager.Maintenance/) | | Resource Management - Managed Grafana | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.Grafana/1.1.1)
NuGet [1.2.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Grafana/1.2.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Grafana-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Grafana_1.1.1/sdk/grafana/Azure.ResourceManager.Grafana/)
GitHub [1.2.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Grafana_1.2.0-beta.3/sdk/grafana/Azure.ResourceManager.Grafana/) | | Resource Management - Managed Network | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.ResourceManager.ManagedNetwork/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedNetwork-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedNetwork_1.0.0-beta.6/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/) | -| Resource Management - Managed Network Fabric | NuGet [1.1.3](https://www.nuget.org/packages/Azure.ResourceManager.ManagedNetworkFabric/1.1.3) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedNetworkFabric-readme) | GitHub [1.1.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedNetworkFabric_1.1.3/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/) | +| Resource Management - Managed Network Fabric | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.ManagedNetworkFabric/1.2.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedNetworkFabric-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedNetworkFabric_1.2.0/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/) | | Resource Management - Managed Service Identity | NuGet [1.4.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServiceIdentities/1.4.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedServiceIdentities-readme) | GitHub [1.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServiceIdentities_1.4.1/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/) | | Resource Management - Managed Services | NuGet [1.1.2](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServices/1.1.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedServices-readme) | GitHub [1.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServices_1.1.2/sdk/managedservices/Azure.ResourceManager.ManagedServices/) | | Resource Management - Managedops | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedOps/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedOps-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedOps_1.0.0-beta.1/sdk/managedops/Azure.ResourceManager.ManagedOps/) | @@ -428,13 +428,13 @@ | Resource Management - Workloadssapvirtualinstance | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.WorkloadsSapVirtualInstance/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.WorkloadsSapVirtualInstance-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.WorkloadsSapVirtualInstance_1.0.0/sdk/workloadssapvirtualinstance/Azure.ResourceManager.WorkloadsSapVirtualInstance/) | | App Configuration Extension | NuGet [8.5.0](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.Functions.Worker/8.5.0)
NuGet [8.6.0-preview](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.Functions.Worker/8.6.0-preview) | | | | App Configuration Provider | NuGet [8.5.0](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.AspNetCore/8.5.0)
NuGet [8.6.0-preview](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.AspNetCore/8.6.0-preview) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp/1.0.0)
NuGet [3.0.0-beta.13](https://www.nuget.org/packages/Azure.Mcp/3.0.0-beta.13) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/1.0.0)
NuGet [3.0.0-beta.13](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/3.0.0-beta.13) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-x64/1.0.0)
NuGet [3.0.0-beta.13](https://www.nuget.org/packages/Azure.Mcp.linux-x64/3.0.0-beta.13) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/1.0.0)
NuGet [3.0.0-beta.13](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/3.0.0-beta.13) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-x64/1.0.0)
NuGet [3.0.0-beta.13](https://www.nuget.org/packages/Azure.Mcp.osx-x64/3.0.0-beta.13) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-arm64/1.0.0)
NuGet [3.0.0-beta.13](https://www.nuget.org/packages/Azure.Mcp.win-arm64/3.0.0-beta.13) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-x64/1.0.0)
NuGet [3.0.0-beta.13](https://www.nuget.org/packages/Azure.Mcp.win-x64/3.0.0-beta.13) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp/3.0.0-beta.14) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/3.0.0-beta.14) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-x64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.linux-x64/3.0.0-beta.14) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/3.0.0-beta.14) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-x64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.osx-x64/3.0.0-beta.14) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-arm64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.win-arm64/3.0.0-beta.14) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-x64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.win-x64/3.0.0-beta.14) | | | | Azure MCP Types Internal | NuGet [0.2.804](https://www.nuget.org/packages/Microsoft.Azure.Mcp.AzTypes.Internal.Compact/0.2.804) | | | | Azure.Communication.Administration | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Communication.Administration/1.0.0-beta.3) | | | | Caching - PostgreSQL | NuGet [1.2.2](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Postgres/1.2.2) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index fd5fcd1730937..2bb7fe16ff4b4 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -131,7 +131,7 @@ | Tables | NuGet [12.11.0](https://www.nuget.org/packages/Azure.Data.Tables/12.11.0) | [docs](/dotnet/api/overview/azure/Data.Tables-readme) | GitHub [12.11.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.Tables_12.11.0/sdk/tables/Azure.Data.Tables/) | | Text Analytics | NuGet [5.3.0](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.3.0) | [docs](/dotnet/api/overview/azure/AI.TextAnalytics-readme) | GitHub [5.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.3.0/sdk/textanalytics/Azure.AI.TextAnalytics/) | | Text Authoring | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Language.Text.Authoring/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Language.Text.Authoring-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.Language.Text.Authoring_1.0.0-beta.2/sdk/cognitivelanguage/Azure.AI.Language.Text.Authoring/) | -| Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Translation.Text/2.0.0-beta.1) | [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/)
GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_2.0.0-beta.1/sdk/translation/Azure.AI.Translation.Text/) | +| Text Translation | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/2.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_2.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.4](https://www.nuget.org/packages/Azure.AI.AgentServer.Invocations/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.AgentServer.Invocations-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Invocations_1.0.0-beta.4/sdk/agentserver/Azure.AI.AgentServer.Invocations/) | @@ -341,7 +341,7 @@ | Resource Management - Maintenance | NuGet [1.1.3](https://www.nuget.org/packages/Azure.ResourceManager.Maintenance/1.1.3)
NuGet [1.2.0-beta.10](https://www.nuget.org/packages/Azure.ResourceManager.Maintenance/1.2.0-beta.10) | [docs](/dotnet/api/overview/azure/ResourceManager.Maintenance-readme) | GitHub [1.1.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Maintenance_1.1.3/sdk/maintenance/Azure.ResourceManager.Maintenance/)
GitHub [1.2.0-beta.10](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Maintenance_1.2.0-beta.10/sdk/maintenance/Azure.ResourceManager.Maintenance/) | | Resource Management - Managed Grafana | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.Grafana/1.1.1)
NuGet [1.2.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Grafana/1.2.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Grafana-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Grafana_1.1.1/sdk/grafana/Azure.ResourceManager.Grafana/)
GitHub [1.2.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Grafana_1.2.0-beta.3/sdk/grafana/Azure.ResourceManager.Grafana/) | | Resource Management - Managed Network | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.ResourceManager.ManagedNetwork/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedNetwork-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedNetwork_1.0.0-beta.6/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/) | -| Resource Management - Managed Network Fabric | NuGet [1.1.3](https://www.nuget.org/packages/Azure.ResourceManager.ManagedNetworkFabric/1.1.3) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedNetworkFabric-readme) | GitHub [1.1.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedNetworkFabric_1.1.3/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/) | +| Resource Management - Managed Network Fabric | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.ManagedNetworkFabric/1.2.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedNetworkFabric-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedNetworkFabric_1.2.0/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/) | | Resource Management - Managed Service Identity | NuGet [1.4.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServiceIdentities/1.4.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedServiceIdentities-readme) | GitHub [1.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServiceIdentities_1.4.1/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/) | | Resource Management - Managed Services | NuGet [1.1.2](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServices/1.1.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedServices-readme) | GitHub [1.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServices_1.1.2/sdk/managedservices/Azure.ResourceManager.ManagedServices/) | | Resource Management - Managedops | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedOps/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedOps-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedOps_1.0.0-beta.1/sdk/managedops/Azure.ResourceManager.ManagedOps/) | From 22a47f46022c0487f2c506fb21236ff13717ff5c Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 29 May 2026 15:55:44 -0700 Subject: [PATCH 2/6] Update package index with latest published versions (#54098) --- docs/azure/includes/dotnet-all.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index f998650007dd8..6bf86ec9d3cf6 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -461,8 +461,8 @@ | IoT Operations Protocol | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Iot.Operations.Protocol/1.2.0) | | | | IoT Operations Services | NuGet [1.2.1](https://www.nuget.org/packages/Azure.Iot.Operations.Services/1.2.1) | | | | IoT Operations Templates | NuGet [0.1.0](https://www.nuget.org/packages/Azure.Iot.Operations.Templates/0.1.0) | | | -| Item Templates NetCore | NuGet [4.0.5569](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetCore/4.0.5569) | | | -| Item Templates NetFx | NuGet [4.0.5569](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetFx/4.0.5569) | | | +| Item Templates NetCore | NuGet [4.0.5584](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetCore/4.0.5584) | | | +| Item Templates NetFx | NuGet [4.0.5584](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetFx/4.0.5584) | | | | MCP Template | NuGet [0.0.12](https://www.nuget.org/packages/Microsoft.Template.Mcp/0.0.12) | | | | MCP Template | NuGet [0.0.12](https://www.nuget.org/packages/Microsoft.Template.Mcp.linux-arm64/0.0.12) | | | | MCP Template | NuGet [0.0.12](https://www.nuget.org/packages/Microsoft.Template.Mcp.linux-x64/0.0.12) | | | @@ -595,10 +595,10 @@ | Functions Extensions - Redis | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Redis/1.0.0) | | | | Functions Extensions - Redis | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Redis/1.0.0) | | | | Functions Extensions - Worker Extentions | NuGet [1.0.1](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Dapr/1.0.1) | | | -| Functions item template pack for Microsoft Template Engine | NuGet [4.0.5569](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ItemTemplates/4.0.5569) | | GitHub [4.0.5569](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) | +| Functions item template pack for Microsoft Template Engine | NuGet [4.0.5584](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ItemTemplates/4.0.5584) | | GitHub [4.0.5584](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) | | Functions OpenAPI app settings deserialization library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/1.4.0)
NuGet [2.0.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/2.0.0-preview2) | | | | Functions OpenAPI document and Swagger UI renderer library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/1.4.0)
NuGet [2.0.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/2.0.0-preview2) | | | -| Functions project template pack for Microsoft Template Engine | NuGet [4.0.5569](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ProjectTemplates/4.0.5569) | | GitHub [4.0.5569](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) | +| Functions project template pack for Microsoft Template Engine | NuGet [4.0.5584](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ProjectTemplates/4.0.5584) | | GitHub [4.0.5584](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) | | Functions runtime assemblies for App Insights logging | NuGet [3.0.46](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/3.0.46) | | GitHub [3.0.46](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18/src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights) | | Functions runtime assemblies for logging | NuGet [4.0.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging/4.0.3) | | | | Functions runtime assemblies for Microsoft.Azure.WebJobs.Host | NuGet [3.0.46](https://www.nuget.org/packages/Microsoft.Azure.WebJobs/3.0.46) | | GitHub [3.0.46](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18/src/Microsoft.Azure.WebJobs) | @@ -632,8 +632,8 @@ | Microsoft.Azure.Functions.Worker.Extensions.Timer | NuGet [4.3.1](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Timer/4.3.1) | | | | Microsoft.Azure.Functions.Worker.Extensions.Warmup | NuGet [4.0.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Warmup/4.0.2) | | | | Microsoft.Azure.Functions.Worker.Grpc | NuGet [2.52.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Grpc/2.52.0) | | | -| Microsoft.Azure.Functions.Worker.ItemTemplates | NuGet [4.0.5569](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates/4.0.5569) | | | -| Microsoft.Azure.Functions.Worker.ProjectTemplates | NuGet [4.0.5569](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ProjectTemplates/4.0.5569) | | | +| Microsoft.Azure.Functions.Worker.ItemTemplates | NuGet [4.0.5584](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates/4.0.5584) | | | +| Microsoft.Azure.Functions.Worker.ProjectTemplates | NuGet [4.0.5584](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ProjectTemplates/4.0.5584) | | | | Microsoft.Azure.Functions.Worker.Sdk | NuGet [2.0.7](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk/2.0.7) | | | | Microsoft.Azure.Functions.Worker.Sdk.Analyzers | NuGet [1.2.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk.Analyzers/1.2.2) | | | | Microsoft.Azure.Functions.Worker.Sdk.Generators | NuGet [1.3.6](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk.Generators/1.3.6) | | | From 566837f3637d1862de4e3732f4891af531c02b09 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Sat, 30 May 2026 11:48:09 -0400 Subject: [PATCH 3/6] Categories for C# 8 diagnostics (#54100) No visible changes. Capture the groups of errors in the C# 8 range, for undocumented errors are warnings. --- ...-we-don-t-have-specifics-on-this-csharp-error.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md index a39a98a9982da..da9a0638ad83c 100644 --- a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md +++ b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md @@ -227,24 +227,33 @@ f1_keywords: - "CS8384" - "CS8385" # C# 8.0 diagnostics + ## Async enumerables - "CS8412" - "CS8413" - "CS8414" - "CS8415" - "CS8419" - "CS8420" + ## Static local functions - "CS8421" + ## Attributes - "CS8423" + ## More async enumerators - "CS8424" - "CS8425" - "CS8426" + ## Index and range - "CS8428" - "CS8429" + ## Can't parse syntax - "CS8635" - "CS8641" + ## Default interface implementation - "CS8646" + ## Patterns - "CS8650" - "CS8651" + ## Readonly struct members - "CS8656" - "CS8662" - "CS8669" @@ -293,6 +302,10 @@ f1_keywords: - "CS9382" - "CS9383" - "CS9384" + # More unions: + - "CS9385" + - "CS9386" + - "CS9387" helpviewer_keywords: - "errors [C#], additional information" --- From 16d369657a778306e296390dff7fc1316aedd53b Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Mon, 1 Jun 2026 07:17:35 -0700 Subject: [PATCH 4/6] Update package index with latest published versions (#54101) --- docs/azure/includes/dotnet-all.md | 22 +++++++++++----------- docs/azure/includes/dotnet-new.md | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 6bf86ec9d3cf6..dc8caca6adc7c 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -4,7 +4,7 @@ | AI Agent Server - Contracts | NuGet [1.0.0-beta.11](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.11) | [docs](/dotnet/api/overview/azure/AI.AgentServer.Contracts-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.11](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.11/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | | AI Agent Server - Core | NuGet [1.0.0-beta.25](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.25) | [docs](/dotnet/api/overview/azure/AI.AgentServer.Core-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.25](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.25/sdk/agentserver/Azure.AI.AgentServer.Core/) | | AI Agents Persistent | NuGet [1.1.0](https://www.nuget.org/packages/Azure.AI.Agents.Persistent/1.1.0)
NuGet [1.2.0-beta.10](https://www.nuget.org/packages/Azure.AI.Agents.Persistent/1.2.0-beta.10) | [docs](/dotnet/api/overview/azure/AI.Agents.Persistent-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Agents.Persistent_1.1.0/sdk/ai/Azure.AI.Agents.Persistent/)
GitHub [1.2.0-beta.10](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Agents.Persistent_1.2.0-beta.10/sdk/ai/Azure.AI.Agents.Persistent/) | -| AI Foundry | NuGet [2.0.1](https://www.nuget.org/packages/Azure.AI.Projects/2.0.1)
NuGet [2.1.0-beta.2](https://www.nuget.org/packages/Azure.AI.Projects/2.1.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Projects-readme) | GitHub [2.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_2.0.1/sdk/ai/Azure.AI.Projects/)
GitHub [2.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_2.1.0-beta.2/sdk/ai/Azure.AI.Projects/) | +| AI Foundry | NuGet [2.0.1](https://www.nuget.org/packages/Azure.AI.Projects/2.0.1)
NuGet [2.1.0-beta.3](https://www.nuget.org/packages/Azure.AI.Projects/2.1.0-beta.3) | [docs](/dotnet/api/overview/azure/AI.Projects-readme) | GitHub [2.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_2.0.1/sdk/ai/Azure.AI.Projects/)
GitHub [2.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_2.1.0-beta.3/sdk/ai/Azure.AI.Projects/) | | AI Model Inference | NuGet [1.0.0-beta.5](https://www.nuget.org/packages/Azure.AI.Inference/1.0.0-beta.5) | [docs](/dotnet/api/overview/azure/AI.Inference-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Inference_1.0.0-beta.5/sdk/ai/Azure.AI.Inference/) | | AI Projects - OpenAI | NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Projects.OpenAI/2.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Projects.OpenAI-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.OpenAI_2.0.0-beta.1/sdk/ai/Azure.AI.Projects.OpenAI/) | | Anomaly Detector | NuGet [3.0.0-preview.7](https://www.nuget.org/packages/Azure.AI.AnomalyDetector/3.0.0-preview.7) | [docs](/dotnet/api/overview/azure/AI.AnomalyDetector-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [3.0.0-preview.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AnomalyDetector_3.0.0-preview.7/sdk/anomalydetector/Azure.AI.AnomalyDetector/) | @@ -124,8 +124,8 @@ | 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.4](https://www.nuget.org/packages/Azure.AI.AgentServer.Invocations/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.AgentServer.Invocations-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Invocations_1.0.0-beta.4/sdk/agentserver/Azure.AI.AgentServer.Invocations/) | | unknown | NuGet [1.0.0-beta.5](https://www.nuget.org/packages/Azure.AI.AgentServer.Responses/1.0.0-beta.5) | [docs](/dotnet/api/overview/azure/AI.AgentServer.Responses-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Responses_1.0.0-beta.5/sdk/agentserver/Azure.AI.AgentServer.Responses/) | -| unknown | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.0.0)
NuGet [2.1.0-beta.2](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.1.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Extensions.OpenAI-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.0.0/sdk/ai/Azure.AI.Extensions.OpenAI/)
GitHub [2.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.1.0-beta.2/sdk/ai/Azure.AI.Extensions.OpenAI/) | -| unknown | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.0.0)
NuGet [2.1.0-beta.2](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.1.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Projects.Agents-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.0.0/sdk/ai/Azure.AI.Projects.Agents/)
GitHub [2.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.1.0-beta.2/sdk/ai/Azure.AI.Projects.Agents/) | +| unknown | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.0.0)
NuGet [2.1.0-beta.3](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.1.0-beta.3) | [docs](/dotnet/api/overview/azure/AI.Extensions.OpenAI-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.0.0/sdk/ai/Azure.AI.Extensions.OpenAI/)
GitHub [2.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.1.0-beta.3/sdk/ai/Azure.AI.Extensions.OpenAI/) | +| unknown | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.0.0)
NuGet [2.1.0-beta.3](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.1.0-beta.3) | [docs](/dotnet/api/overview/azure/AI.Projects.Agents-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.0.0/sdk/ai/Azure.AI.Projects.Agents/)
GitHub [2.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.1.0-beta.3/sdk/ai/Azure.AI.Projects.Agents/) | | unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.PostgreSQL.Auth/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.PostgreSQL.Auth-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.PostgreSQL.Auth_1.0.0-beta.1/sdk/postgresql/Microsoft.Azure.PostgreSQL.Auth/) | | Vision Common | NuGet [0.15.1-beta.1](https://www.nuget.org/packages/Azure.AI.Vision.Common/0.15.1-beta.1) | | GitHub [0.15.1-beta.1](https://msasg.visualstudio.com/Skyman/_git/Carbon) | | Voice Live | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.0.0)
NuGet [1.1.0-beta.4](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.1.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.VoiceLive-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.0.0/sdk/voicelive/Azure.AI.VoiceLive/)
GitHub [1.1.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.1.0-beta.4/sdk/voicelive/Azure.AI.VoiceLive/) | @@ -325,7 +325,7 @@ | Resource Management - Managed Grafana | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.Grafana/1.1.1)
NuGet [1.2.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Grafana/1.2.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Grafana-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Grafana_1.1.1/sdk/grafana/Azure.ResourceManager.Grafana/)
GitHub [1.2.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Grafana_1.2.0-beta.3/sdk/grafana/Azure.ResourceManager.Grafana/) | | Resource Management - Managed Network | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.ResourceManager.ManagedNetwork/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedNetwork-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedNetwork_1.0.0-beta.6/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/) | | Resource Management - Managed Network Fabric | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.ManagedNetworkFabric/1.2.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedNetworkFabric-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedNetworkFabric_1.2.0/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/) | -| Resource Management - Managed Service Identity | NuGet [1.4.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServiceIdentities/1.4.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedServiceIdentities-readme) | GitHub [1.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServiceIdentities_1.4.1/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/) | +| Resource Management - Managed Service Identity | NuGet [1.4.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServiceIdentities/1.4.1)
NuGet [1.5.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServiceIdentities/1.5.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedServiceIdentities-readme) | GitHub [1.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServiceIdentities_1.4.1/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/)
GitHub [1.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServiceIdentities_1.5.0-beta.1/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/) | | Resource Management - Managed Services | NuGet [1.1.2](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServices/1.1.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedServices-readme) | GitHub [1.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServices_1.1.2/sdk/managedservices/Azure.ResourceManager.ManagedServices/) | | Resource Management - Managedops | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedOps/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedOps-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedOps_1.0.0-beta.1/sdk/managedops/Azure.ResourceManager.ManagedOps/) | | Resource Management - Management Partner | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.ResourceManager.ManagementPartner/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagementPartner-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagementPartner_1.0.0-beta.6/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/) | @@ -428,13 +428,13 @@ | Resource Management - Workloadssapvirtualinstance | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.WorkloadsSapVirtualInstance/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.WorkloadsSapVirtualInstance-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.WorkloadsSapVirtualInstance_1.0.0/sdk/workloadssapvirtualinstance/Azure.ResourceManager.WorkloadsSapVirtualInstance/) | | App Configuration Extension | NuGet [8.5.0](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.Functions.Worker/8.5.0)
NuGet [8.6.0-preview](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.Functions.Worker/8.6.0-preview) | | | | App Configuration Provider | NuGet [8.5.0](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.AspNetCore/8.5.0)
NuGet [8.6.0-preview](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.AspNetCore/8.6.0-preview) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp/3.0.0-beta.14) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/3.0.0-beta.14) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-x64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.linux-x64/3.0.0-beta.14) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/3.0.0-beta.14) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-x64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.osx-x64/3.0.0-beta.14) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-arm64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.win-arm64/3.0.0-beta.14) | | | -| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-x64/1.0.0)
NuGet [3.0.0-beta.14](https://www.nuget.org/packages/Azure.Mcp.win-x64/3.0.0-beta.14) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp/1.0.0)
NuGet [3.0.0-beta.15](https://www.nuget.org/packages/Azure.Mcp/3.0.0-beta.15) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/1.0.0)
NuGet [3.0.0-beta.15](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/3.0.0-beta.15) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-x64/1.0.0)
NuGet [3.0.0-beta.15](https://www.nuget.org/packages/Azure.Mcp.linux-x64/3.0.0-beta.15) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/1.0.0)
NuGet [3.0.0-beta.15](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/3.0.0-beta.15) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-x64/1.0.0)
NuGet [3.0.0-beta.15](https://www.nuget.org/packages/Azure.Mcp.osx-x64/3.0.0-beta.15) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-arm64/1.0.0)
NuGet [3.0.0-beta.15](https://www.nuget.org/packages/Azure.Mcp.win-arm64/3.0.0-beta.15) | | | +| Azure MCP | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-x64/1.0.0)
NuGet [3.0.0-beta.15](https://www.nuget.org/packages/Azure.Mcp.win-x64/3.0.0-beta.15) | | | | Azure MCP Types Internal | NuGet [0.2.804](https://www.nuget.org/packages/Microsoft.Azure.Mcp.AzTypes.Internal.Compact/0.2.804) | | | | Azure.Communication.Administration | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Communication.Administration/1.0.0-beta.3) | | | | Caching - PostgreSQL | NuGet [1.2.2](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Postgres/1.2.2) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 2bb7fe16ff4b4..b474a47c88c6c 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -4,7 +4,7 @@ | AI Agent Server - Contracts | NuGet [1.0.0-beta.11](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.11) | [docs](/dotnet/api/overview/azure/AI.AgentServer.Contracts-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.11](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.11/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | | AI Agent Server - Core | NuGet [1.0.0-beta.25](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.25) | [docs](/dotnet/api/overview/azure/AI.AgentServer.Core-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.25](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.25/sdk/agentserver/Azure.AI.AgentServer.Core/) | | AI Agents Persistent | NuGet [1.1.0](https://www.nuget.org/packages/Azure.AI.Agents.Persistent/1.1.0)
NuGet [1.2.0-beta.10](https://www.nuget.org/packages/Azure.AI.Agents.Persistent/1.2.0-beta.10) | [docs](/dotnet/api/overview/azure/AI.Agents.Persistent-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Agents.Persistent_1.1.0/sdk/ai/Azure.AI.Agents.Persistent/)
GitHub [1.2.0-beta.10](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Agents.Persistent_1.2.0-beta.10/sdk/ai/Azure.AI.Agents.Persistent/) | -| AI Foundry | NuGet [2.0.1](https://www.nuget.org/packages/Azure.AI.Projects/2.0.1)
NuGet [2.1.0-beta.2](https://www.nuget.org/packages/Azure.AI.Projects/2.1.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Projects-readme) | GitHub [2.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_2.0.1/sdk/ai/Azure.AI.Projects/)
GitHub [2.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_2.1.0-beta.2/sdk/ai/Azure.AI.Projects/) | +| AI Foundry | NuGet [2.0.1](https://www.nuget.org/packages/Azure.AI.Projects/2.0.1)
NuGet [2.1.0-beta.3](https://www.nuget.org/packages/Azure.AI.Projects/2.1.0-beta.3) | [docs](/dotnet/api/overview/azure/AI.Projects-readme) | GitHub [2.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_2.0.1/sdk/ai/Azure.AI.Projects/)
GitHub [2.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_2.1.0-beta.3/sdk/ai/Azure.AI.Projects/) | | AI Model Inference | NuGet [1.0.0-beta.5](https://www.nuget.org/packages/Azure.AI.Inference/1.0.0-beta.5) | [docs](/dotnet/api/overview/azure/AI.Inference-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Inference_1.0.0-beta.5/sdk/ai/Azure.AI.Inference/) | | AI Projects - OpenAI | NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Projects.OpenAI/2.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Projects.OpenAI-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.OpenAI_2.0.0-beta.1/sdk/ai/Azure.AI.Projects.OpenAI/) | | Anomaly Detector | NuGet [3.0.0-preview.7](https://www.nuget.org/packages/Azure.AI.AnomalyDetector/3.0.0-preview.7) | [docs](/dotnet/api/overview/azure/AI.AnomalyDetector-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [3.0.0-preview.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AnomalyDetector_3.0.0-preview.7/sdk/anomalydetector/Azure.AI.AnomalyDetector/) | @@ -136,8 +136,8 @@ | 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.4](https://www.nuget.org/packages/Azure.AI.AgentServer.Invocations/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.AgentServer.Invocations-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Invocations_1.0.0-beta.4/sdk/agentserver/Azure.AI.AgentServer.Invocations/) | | unknown | NuGet [1.0.0-beta.5](https://www.nuget.org/packages/Azure.AI.AgentServer.Responses/1.0.0-beta.5) | [docs](/dotnet/api/overview/azure/AI.AgentServer.Responses-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Responses_1.0.0-beta.5/sdk/agentserver/Azure.AI.AgentServer.Responses/) | -| unknown | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.0.0)
NuGet [2.1.0-beta.2](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.1.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Extensions.OpenAI-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.0.0/sdk/ai/Azure.AI.Extensions.OpenAI/)
GitHub [2.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.1.0-beta.2/sdk/ai/Azure.AI.Extensions.OpenAI/) | -| unknown | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.0.0)
NuGet [2.1.0-beta.2](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.1.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Projects.Agents-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.0.0/sdk/ai/Azure.AI.Projects.Agents/)
GitHub [2.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.1.0-beta.2/sdk/ai/Azure.AI.Projects.Agents/) | +| unknown | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.0.0)
NuGet [2.1.0-beta.3](https://www.nuget.org/packages/Azure.AI.Extensions.OpenAI/2.1.0-beta.3) | [docs](/dotnet/api/overview/azure/AI.Extensions.OpenAI-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.0.0/sdk/ai/Azure.AI.Extensions.OpenAI/)
GitHub [2.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Extensions.OpenAI_2.1.0-beta.3/sdk/ai/Azure.AI.Extensions.OpenAI/) | +| unknown | NuGet [2.0.0](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.0.0)
NuGet [2.1.0-beta.3](https://www.nuget.org/packages/Azure.AI.Projects.Agents/2.1.0-beta.3) | [docs](/dotnet/api/overview/azure/AI.Projects.Agents-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.0.0/sdk/ai/Azure.AI.Projects.Agents/)
GitHub [2.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects.Agents_2.1.0-beta.3/sdk/ai/Azure.AI.Projects.Agents/) | | unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.PostgreSQL.Auth/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.PostgreSQL.Auth-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.PostgreSQL.Auth_1.0.0-beta.1/sdk/postgresql/Microsoft.Azure.PostgreSQL.Auth/) | | Video Analyzer Edge | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.Media.VideoAnalyzer.Edge/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Media.VideoAnalyzer.Edge-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Media.VideoAnalyzer.Edge_1.0.0-beta.6/sdk/videoanalyzer/Azure.Media.VideoAnalyzer.Edge/) | | Vision Common | NuGet [0.15.1-beta.1](https://www.nuget.org/packages/Azure.AI.Vision.Common/0.15.1-beta.1) | | GitHub [0.15.1-beta.1](https://msasg.visualstudio.com/Skyman/_git/Carbon) | @@ -342,7 +342,7 @@ | Resource Management - Managed Grafana | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.Grafana/1.1.1)
NuGet [1.2.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Grafana/1.2.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Grafana-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Grafana_1.1.1/sdk/grafana/Azure.ResourceManager.Grafana/)
GitHub [1.2.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Grafana_1.2.0-beta.3/sdk/grafana/Azure.ResourceManager.Grafana/) | | Resource Management - Managed Network | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.ResourceManager.ManagedNetwork/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedNetwork-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedNetwork_1.0.0-beta.6/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/) | | Resource Management - Managed Network Fabric | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.ManagedNetworkFabric/1.2.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedNetworkFabric-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedNetworkFabric_1.2.0/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/) | -| Resource Management - Managed Service Identity | NuGet [1.4.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServiceIdentities/1.4.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedServiceIdentities-readme) | GitHub [1.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServiceIdentities_1.4.1/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/) | +| Resource Management - Managed Service Identity | NuGet [1.4.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServiceIdentities/1.4.1)
NuGet [1.5.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServiceIdentities/1.5.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedServiceIdentities-readme) | GitHub [1.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServiceIdentities_1.4.1/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/)
GitHub [1.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServiceIdentities_1.5.0-beta.1/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/) | | Resource Management - Managed Services | NuGet [1.1.2](https://www.nuget.org/packages/Azure.ResourceManager.ManagedServices/1.1.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedServices-readme) | GitHub [1.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedServices_1.1.2/sdk/managedservices/Azure.ResourceManager.ManagedServices/) | | Resource Management - Managedops | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ManagedOps/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagedOps-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagedOps_1.0.0-beta.1/sdk/managedops/Azure.ResourceManager.ManagedOps/) | | Resource Management - Management Partner | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.ResourceManager.ManagementPartner/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/ResourceManager.ManagementPartner-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ManagementPartner_1.0.0-beta.6/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/) | From 31be9d1a9dfc6d1f6a2253e95a3b1f6d689f9e54 Mon Sep 17 00:00:00 2001 From: Mahmoud Elgohary <14031701+melgoharyme@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:19:18 +0300 Subject: [PATCH 5/6] Update get-started.md to add beginner code explanation sections (#54102) Add two sections to the Get started with .NET tutorial: - Add "Understand the code" section that breaks down Console.WriteLine("Hello, World!") into its parts. - Add "How file-based apps work" section that explains what `dotnet hello-world.cs` do and why no project file is needed. No existing content was modified. --- docs/core/get-started.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/core/get-started.md b/docs/core/get-started.md index ebeddfe68d06b..8678c3a21ab9f 100644 --- a/docs/core/get-started.md +++ b/docs/core/get-started.md @@ -53,6 +53,33 @@ You ran your first .NET app. It's a simple app that prints the message "Hello, W Congratulations! You created a simple .NET application. +## Understand the code + +The app consists of a single line of C# code: + +```csharp +Console.WriteLine("Hello, World!"); +``` + +Breaking down each part: + +- `Console` is a built-in .NET type that provides functionality for working with the console. +- `WriteLine` is a method of `Console` that writes text followed by a new line. +- `"Hello, World!"` is a string literal, a sequence of characters enclosed in double quotation marks. The text inside the string is what gets displayed in the console. +- The semicolon (`;`) marks the end of a statement in C#. + +## How file-based apps work + +When you run the following command: + +```dotnetcli +dotnet hello-world.cs +``` + +The .NET SDK automatically compiles the `.cs` file and runs the resulting app in one step. You don't need a project file (`.csproj`) or any extra setup. + +File-based apps are useful for learning, experimenting, and writing small utilities. As your applications grow, you'll typically use project-based apps to organize code, dependencies, and configuration. + ## Cleanup resources GitHub automatically deletes your Codespace after 30 days of inactivity. If you plan to continue with .NET tutorials, you can leave your Codespace provisioned. If you're ready to download the .NET SDK to your computer, you can delete your Codespace. To delete your Codespace, open a browser window and navigate to [your Codespaces](https://github.com/codespaces). You should see a list of your codespaces in the window. Select the three dots (`...`) in the entry for the tutorial codespace and select **delete**. From ea7f9398a1d603955c4c6dcf191b9d8797c26be8 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Mon, 1 Jun 2026 11:22:36 -0400 Subject: [PATCH 6/6] [Everyday C#] - PR 11. String interpolation search split (#53991) * Create new snippets Build the projects for this PR. * Build main articles Build the main articles for this PR. * Move advanced material to lang ref Move the advanced material into an appropriate language reference article. This information doesn't fit the fundamentals goals, but is important for more advanced developers. * Update TOCs * Redirects and removal Remove (now) obsolete articles. Add necessary redirects. * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Fix warnings. * content review Review the major changes and edit / content review. * Fix warnings. * fix warnings * Review. * Create "common-tasks" Create the common tasks section for what had been "How to" articles. * Final proofread Do a final edit pass. * Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .openpublishing.redirection.csharp.json | 12 ++ .../nullable-migration-strategies.md | 10 +- .../{ => common-tasks}/resolve-warnings.md | 34 +-- .../snippets/resolve-warnings/Program.cs | 0 .../resolve-warnings/project-snippet.xml | 0 .../resolve-warnings/resolve-warnings.csproj | 0 .../null-safety/nullable-reference-types.md | 2 +- .../strings/common-tasks/search.md | 63 ++++++ .../common-tasks/snippets/search/Program.cs | 65 ++++++ .../snippets/search/search.csproj | 8 + .../common-tasks/snippets/split/Program.cs | 198 ++++++++++++++++++ .../common-tasks/snippets/split/split.csproj | 8 + .../strings/common-tasks/split.md | 80 +++++++ .../fundamentals/strings/interpolation.md | 101 +++++++++ .../strings/snippets/interpolation/Program.cs | 180 ++++++++++++++++ .../interpolation/interpolation.csproj | 8 + .../tutorials/nullable-reference-types.md | 2 +- docs/csharp/how-to/index.md | 4 +- docs/csharp/how-to/modify-string-contents.md | 2 +- .../how-to/parse-strings-using-split.md | 103 --------- docs/csharp/how-to/search-strings.md | 72 ------- .../strings/ParseStringsUsingSplit.cs | 165 --------------- .../csharp/how-to/snippets/strings/Program.cs | 6 - .../how-to/snippets/strings/SearchStrings.cs | 117 ----------- .../snippets/string-operations/Program.cs | 90 ++++++++ .../string-operations.csproj | 8 + .../builtin-types/string-operations.md | 72 +++++++ docs/csharp/language-reference/toc.yml | 3 + .../csharp/programming-guide/strings/index.md | 6 +- docs/csharp/toc.yml | 23 +- docs/csharp/tutorials/string-interpolation.md | 5 +- docs/standard/base-types/divide-up-strings.md | 2 +- 32 files changed, 944 insertions(+), 505 deletions(-) rename docs/csharp/fundamentals/null-safety/{ => common-tasks}/resolve-warnings.md (79%) rename docs/csharp/fundamentals/null-safety/{ => common-tasks}/snippets/resolve-warnings/Program.cs (100%) rename docs/csharp/fundamentals/null-safety/{ => common-tasks}/snippets/resolve-warnings/project-snippet.xml (100%) rename docs/csharp/fundamentals/null-safety/{ => common-tasks}/snippets/resolve-warnings/resolve-warnings.csproj (100%) create mode 100644 docs/csharp/fundamentals/strings/common-tasks/search.md create mode 100644 docs/csharp/fundamentals/strings/common-tasks/snippets/search/Program.cs create mode 100644 docs/csharp/fundamentals/strings/common-tasks/snippets/search/search.csproj create mode 100644 docs/csharp/fundamentals/strings/common-tasks/snippets/split/Program.cs create mode 100644 docs/csharp/fundamentals/strings/common-tasks/snippets/split/split.csproj create mode 100644 docs/csharp/fundamentals/strings/common-tasks/split.md create mode 100644 docs/csharp/fundamentals/strings/interpolation.md create mode 100644 docs/csharp/fundamentals/strings/snippets/interpolation/Program.cs create mode 100644 docs/csharp/fundamentals/strings/snippets/interpolation/interpolation.csproj delete mode 100644 docs/csharp/how-to/parse-strings-using-split.md delete mode 100644 docs/csharp/how-to/search-strings.md delete mode 100644 docs/csharp/how-to/snippets/strings/ParseStringsUsingSplit.cs delete mode 100644 docs/csharp/how-to/snippets/strings/SearchStrings.cs create mode 100644 docs/csharp/language-reference/builtin-types/snippets/string-operations/Program.cs create mode 100644 docs/csharp/language-reference/builtin-types/snippets/string-operations/string-operations.csproj create mode 100644 docs/csharp/language-reference/builtin-types/string-operations.md diff --git a/.openpublishing.redirection.csharp.json b/.openpublishing.redirection.csharp.json index 95d02d0fa394a..647c6af4fce81 100644 --- a/.openpublishing.redirection.csharp.json +++ b/.openpublishing.redirection.csharp.json @@ -648,6 +648,10 @@ "source_path_from_root": "/docs/csharp/features.md", "redirect_url": "/dotnet/csharp/programming-guide/concepts" }, + { + "source_path_from_root": "/docs/csharp/fundamentals/null-safety/resolve-warnings.md", + "redirect_url": "/dotnet/csharp/fundamentals/null-safety/common-tasks/resolve-warnings" + }, { "source_path_from_root": "/docs/csharp/generics.md", "redirect_url": "/dotnet/csharp/fundamentals/types/generics" @@ -719,10 +723,18 @@ "source_path_from_root": "/docs/csharp/getting-started/with-visual-studio.md", "redirect_url": "/dotnet/core/tutorials/with-visual-studio" }, + { + "source_path_from_root": "/docs/csharp/how-to/parse-strings-using-split.md", + "redirect_url": "/dotnet/csharp/fundamentals/strings/split" + }, { "source_path_from_root": "/docs/csharp/how-to/safely-cast-using-pattern-matching-is-and-as-operators.md", "redirect_url": "/dotnet/csharp/fundamentals/tutorials/safely-cast-using-pattern-matching-is-and-as-operators" }, + { + "source_path_from_root": "/docs/csharp/how-to/search-strings.md", + "redirect_url": "/dotnet/csharp/fundamentals/strings/search" + }, { "source_path_from_root": "/docs/csharp/implicitly-typed-lambda-expressions.md", "redirect_url": "/dotnet/csharp/language-reference/operators/lambda-expressions" diff --git a/docs/csharp/advanced-topics/update-applications/nullable-migration-strategies.md b/docs/csharp/advanced-topics/update-applications/nullable-migration-strategies.md index 970c9c4fee6ba..f9acdb9040135 100644 --- a/docs/csharp/advanced-topics/update-applications/nullable-migration-strategies.md +++ b/docs/csharp/advanced-topics/update-applications/nullable-migration-strategies.md @@ -9,7 +9,7 @@ ai-usage: ai-assisted # Nullable migration strategies > [!TIP] -> **Starting a new project?** New projects created from .NET 6 or later templates already have `enable` set. You don't need a migration strategy: skip to [Resolve nullable warnings](../../fundamentals/null-safety/resolve-warnings.md). +> **Starting a new project?** New projects created from .NET 6 or later templates already have `enable` set. You don't need a migration strategy: skip to [Resolve nullable warnings](../../fundamentals/null-safety/common-tasks/resolve-warnings.md). > > **Maintaining an existing codebase?** Read [Nullable reference types](../../fundamentals/null-safety/nullable-reference-types.md) first to understand contexts, annotations, and null-state. This article assumes you're familiar with those concepts and ready to plan a rollout. @@ -49,7 +49,7 @@ The most predictable way to migrate a large project is to enable warnings or ann 1. Pick a file. Start with the deepest leaf types in your dependency graph, then move outward. Annotating a type causes new warnings in its callers, so working bottom-up minimizes rework. 1. Add the `#nullable` directive that opts the file into the new behavior. Use `#nullable enable` if you want both flags. Use `#nullable enable warnings` for warning-only. -1. Address the warnings in the file using the techniques in [Resolve nullable warnings](../../fundamentals/null-safety/resolve-warnings.md). +1. Address the warnings in the file using the techniques in [Resolve nullable warnings](../../fundamentals/null-safety/common-tasks/resolve-warnings.md). 1. Repeat for the next file. 1. When every file in the project has its directive, remove the directives and set `enable` at the project level. @@ -71,7 +71,7 @@ Lead with warnings when fixing latent enable [!TIP] -> **New to nullable reference types?** Read [Nullable reference types](nullable-reference-types.md) first to understand annotations and null-state analysis. This article assumes you're seeing warnings in a project where the feature is enabled. +> **New to nullable reference types?** Read [Nullable reference types](../nullable-reference-types.md) first to understand annotations and null-state analysis. This article assumes you're seeing warnings in a project where the feature is enabled. > -> **Looking for a specific compiler error code?** The [Resolve nullable warnings](../../language-reference/compiler-messages/nullable-warnings.md) reference article catalogs every CS86xx warning with the matching technique. +> **Looking for a specific compiler error code?** The [Resolve nullable warnings](../../../language-reference/compiler-messages/nullable-warnings.md) reference article catalogs every CS86xx warning with the matching technique. When you enable nullable reference types, the compiler issues warnings everywhere your code's behavior doesn't match its annotations. Most warnings fall into a small set of patterns. Once you recognize the pattern, the fix is usually one of five techniques: @@ -42,13 +42,13 @@ The fix is usually a *guard clause*. A *guard clause* is a check at the top of a :::code language="csharp" source="snippets/resolve-warnings/Program.cs" id="DereferenceFixed"::: -[Pattern matching](../../language-reference/operators/patterns.md) (expressions such as `is null` or `is { }` that test the shape of a value), `??`, and `??=` include null checks: +[Pattern matching](../../../language-reference/operators/patterns.md) (expressions such as `is null` or `is { }` that test the shape of a value), `??`, and `??=` include null checks: :::code language="csharp" source="snippets/resolve-warnings/Program.cs" id="NullOperatorsFix"::: The property pattern `{ Length: > 0 }` matches only when `message` is non-null *and* its `Length` property is greater than zero, so the compiler treats `message` as *not-null* inside the `if` block. A simpler `is not null` test produces the same null-state narrowing without inspecting any properties. -For an in-depth tour of the operators, see [Null operators](null-operators.md). +For an in-depth tour of the operators, see [Null operators](../null-operators.md). ## Adjust annotations @@ -73,7 +73,7 @@ Sometimes the right fix isn't at the call site. A method's signature doesn't cap :::code language="csharp" source="snippets/resolve-warnings/Program.cs" id="MissingAttribute"::: -The body of `IsPresent` proves the argument isn't null when the method returns `true`, but the signature doesn't say so. Add a [nullable analysis attribute](../../language-reference/attributes/nullable-analysis.md) to make the contract part of the API: +The body of `IsPresent` proves the argument isn't null when the method returns `true`, but the signature doesn't say so. Add a [nullable analysis attribute](../../../language-reference/attributes/nullable-analysis.md) to make the contract part of the API: :::code language="csharp" source="snippets/resolve-warnings/Program.cs" id="WithAttribute"::: @@ -84,21 +84,21 @@ Common attributes include: - — the listed members are *not-null* after the method returns. - — the method never returns normally (for example, it always throws). -The full list is in [Nullable static analysis attributes](../../language-reference/attributes/nullable-analysis.md). +The full list is in [Nullable static analysis attributes](../../../language-reference/attributes/nullable-analysis.md). ## Initialize non-nullable members -A constructor warning means a non-nullable field, property, or [auto-property](../../programming-guide/classes-and-structs/auto-implemented-properties.md) (a property that uses the compiler-generated backing field, such as `public string Name { get; set; }`) exits the constructor without being assigned a non-null value: +A constructor warning means a non-nullable field, property, or [auto-property](../../../programming-guide/classes-and-structs/auto-implemented-properties.md) (a property that uses the compiler-generated backing field, such as `public string Name { get; set; }`) exits the constructor without being assigned a non-null value: :::code language="csharp" source="snippets/resolve-warnings/Program.cs" id="UninitializedMember"::: You have several ways to address it. Pick the one that best matches your design intent. -**Require the value as a constructor argument.** Use a [primary constructor](../../whats-new/tutorials/primary-constructors.md) (parameters declared on the type itself, available throughout the body) or a regular constructor that initializes the property: +**Require the value as a constructor argument.** Use a [primary constructor](../../../whats-new/tutorials/primary-constructors.md) (parameters declared on the type itself, available throughout the body) or a regular constructor that initializes the property: :::code language="csharp" source="snippets/resolve-warnings/Program.cs" id="ConstructorInjected"::: -**Make the property `required`.** The caller must initialize it through an [object initializer](../../programming-guide/classes-and-structs/object-and-collection-initializers.md) (the `{ Property = value }` syntax that follows `new`): +**Make the property `required`.** The caller must initialize it through an [object initializer](../../../programming-guide/classes-and-structs/object-and-collection-initializers.md) (the `{ Property = value }` syntax that follows `new`): :::code language="csharp" source="snippets/resolve-warnings/Program.cs" id="RequiredMember"::: @@ -123,18 +123,18 @@ New C# projects enable nullable reference types by default, so most code you wri The common supported values are `enable` (the default for new projects) and `disable`. If the element is missing, the project uses whatever default the SDK and target framework set. -If you need to enable nullable for only part of a file with `#nullable` directives, or use the partial `warnings` and `annotations` modes when migrating an existing codebase, see [Nullable migration strategies](../../advanced-topics/update-applications/nullable-migration-strategies.md). +If you need to enable nullable for only part of a file with `#nullable` directives, or use the partial `warnings` and `annotations` modes when migrating an existing codebase, see [Nullable migration strategies](../../../advanced-topics/update-applications/nullable-migration-strategies.md). ## Where to go next -When a warning doesn't fit any of these patterns, the [Resolve nullable warnings](../../language-reference/compiler-messages/nullable-warnings.md) reference article lists the technique for every CS86xx warning the compiler emits. +When a warning doesn't fit any of these patterns, the [Resolve nullable warnings](../../../language-reference/compiler-messages/nullable-warnings.md) reference article lists the technique for every CS86xx warning the compiler emits. -To plan a migration that progressively enables nullable reference types in an existing codebase, see [Nullable migration strategies](../../advanced-topics/update-applications/nullable-migration-strategies.md). +To plan a migration that progressively enables nullable reference types in an existing codebase, see [Nullable migration strategies](../../../advanced-topics/update-applications/nullable-migration-strategies.md). ## Related content -- [Nullable reference types](nullable-reference-types.md) -- [Null operators](null-operators.md) -- [Nullable migration strategies](../../advanced-topics/update-applications/nullable-migration-strategies.md) -- [Nullable static analysis attributes](../../language-reference/attributes/nullable-analysis.md) -- [Resolve nullable warnings (compiler reference)](../../language-reference/compiler-messages/nullable-warnings.md) +- [Nullable reference types](../nullable-reference-types.md) +- [Null operators](../null-operators.md) +- [Nullable migration strategies](../../../advanced-topics/update-applications/nullable-migration-strategies.md) +- [Nullable static analysis attributes](../../../language-reference/attributes/nullable-analysis.md) +- [Resolve nullable warnings (compiler reference)](../../../language-reference/compiler-messages/nullable-warnings.md) diff --git a/docs/csharp/fundamentals/null-safety/snippets/resolve-warnings/Program.cs b/docs/csharp/fundamentals/null-safety/common-tasks/snippets/resolve-warnings/Program.cs similarity index 100% rename from docs/csharp/fundamentals/null-safety/snippets/resolve-warnings/Program.cs rename to docs/csharp/fundamentals/null-safety/common-tasks/snippets/resolve-warnings/Program.cs diff --git a/docs/csharp/fundamentals/null-safety/snippets/resolve-warnings/project-snippet.xml b/docs/csharp/fundamentals/null-safety/common-tasks/snippets/resolve-warnings/project-snippet.xml similarity index 100% rename from docs/csharp/fundamentals/null-safety/snippets/resolve-warnings/project-snippet.xml rename to docs/csharp/fundamentals/null-safety/common-tasks/snippets/resolve-warnings/project-snippet.xml diff --git a/docs/csharp/fundamentals/null-safety/snippets/resolve-warnings/resolve-warnings.csproj b/docs/csharp/fundamentals/null-safety/common-tasks/snippets/resolve-warnings/resolve-warnings.csproj similarity index 100% rename from docs/csharp/fundamentals/null-safety/snippets/resolve-warnings/resolve-warnings.csproj rename to docs/csharp/fundamentals/null-safety/common-tasks/snippets/resolve-warnings/resolve-warnings.csproj diff --git a/docs/csharp/fundamentals/null-safety/nullable-reference-types.md b/docs/csharp/fundamentals/null-safety/nullable-reference-types.md index 200dbe9698a27..04473b0c63e23 100644 --- a/docs/csharp/fundamentals/null-safety/nullable-reference-types.md +++ b/docs/csharp/fundamentals/null-safety/nullable-reference-types.md @@ -110,7 +110,7 @@ Initialize array elements as part of creating the array. [Collection expressions ## Related content - [Tutorial: Express your design intent with nullable and non-nullable reference types](../tutorials/nullable-reference-types.md) -- [Resolve nullable warnings](resolve-warnings.md) +- [Resolve nullable warnings](./common-tasks/resolve-warnings.md) - [Nullable migration strategies](../../advanced-topics/update-applications/nullable-migration-strategies.md) - [Nullable static analysis attributes](../../language-reference/attributes/nullable-analysis.md) - [Resolve nullable warnings (compiler reference)](../../language-reference/compiler-messages/nullable-warnings.md) diff --git a/docs/csharp/fundamentals/strings/common-tasks/search.md b/docs/csharp/fundamentals/strings/common-tasks/search.md new file mode 100644 index 0000000000000..a1bfeea2ad038 --- /dev/null +++ b/docs/csharp/fundamentals/strings/common-tasks/search.md @@ -0,0 +1,63 @@ +--- +title: "Search strings in C#" +description: Learn how to find text within strings in C# with the Contains, StartsWith, EndsWith, IndexOf, and LastIndexOf methods, and how to choose the right StringComparison. +ms.date: 05/21/2026 +ms.topic: concept-article +ai-usage: ai-assisted +--- + +# Search strings in C\# + +> [!TIP] +> This article is part of the **Fundamentals** section for developers who already know at least one programming language and are learning C#. If you're new to programming, start with the [Get started](../../../tour-of-csharp/tutorials/index.md) tutorials first. +> +> **Coming from another language?** C# `string` methods such as `Contains`, `StartsWith`, and `IndexOf` parallel methods in Java's `String` and JavaScript's `String.prototype`. The key difference is that some C# searches default to **ordinal, case-sensitive** comparison. Others default to the current culture's semantics. For user-facing searches, you might want to pass a value. + +The class includes methods that answer two everyday questions: + +- *Does this string contain that text?* — use , , or . +- *Where does that text occur?* — use or . + +More complex search and replacement algorithms can be built using regular expressions. For more information on regular expressions and other string operations, see the language reference article on [String operations](../../../language-reference/builtin-types/string-operations.md). + +## Check whether a string contains text + +Use `Contains`, `StartsWith`, or `EndsWith` to test for the presence of a substring: + +:::code language="csharp" source="snippets/search/Program.cs" id="contains"::: + +These methods default to **case-sensitive, ordinal** comparison. To accept user input or to ignore case for display text, pass a value such as or . + +When you search for a single character, use the `char` overload of `Contains`. It avoids allocating a one-character string and is more direct: + +:::code language="csharp" source="snippets/search/Program.cs" id="ContainsChar"::: + +## Locate the position of text + +`IndexOf` returns the zero-based index of the first occurrence of a substring (or character), and `LastIndexOf` returns the index of the last occurrence. Both return `-1` when the search text isn't present. Combine them to extract the text between two markers: + +:::code language="csharp" source="snippets/search/Program.cs" id="IndexOf"::: + +When you need every occurrence rather than the first or last, iterate by passing the previous result plus one as the `startIndex` argument, or switch to a regular expression. + +## Choose the right comparison + +Most search overloads accept an optional value. Pick it based on the kind of data you're searching: + +- If you're searching identifiers, file paths, protocol tokens, or anything else machine-defined, use . +- If you're searching the same kind of machine-defined data but want case insensitivity, use . +- If you're searching user-visible text where the current locale's rules should apply, use . +- If you're searching that same user-visible text and want to ignore case, use . +- If you're searching persisted data that must compare the same on every machine and culture, use (rarely needed). + +Ordinal comparison is the fastest option and the right default for anything that isn't natural-language text. Culture-aware comparison is significantly slower and can produce surprising results. For example, in some cultures the lowercase `i` doesn't match an uppercase `I`.Reserve it for searches that users perform against prose. + +For an in-depth treatment of culture-aware comparison, see [Best practices for comparing strings](../../../../standard/base-types/best-practices-strings.md). + +## See also + +- [String operations: pattern matching, performance, and span-based search](../../../language-reference/builtin-types/string-operations.md) +- [Best practices for comparing strings in .NET](../../../../standard/base-types/best-practices-strings.md) +- [Comparing strings](../../../../standard/base-types/comparing.md) +- +- diff --git a/docs/csharp/fundamentals/strings/common-tasks/snippets/search/Program.cs b/docs/csharp/fundamentals/strings/common-tasks/snippets/search/Program.cs new file mode 100644 index 0000000000000..0deacbd654d1e --- /dev/null +++ b/docs/csharp/fundamentals/strings/common-tasks/snippets/search/Program.cs @@ -0,0 +1,65 @@ +namespace SearchStrings; + +public static class Program +{ + public static void Main() + { + Contains(); + Console.WriteLine(); + ContainsChar(); + Console.WriteLine(); + IndexOfExample(); + } + + private static void Contains() + { + // + string factMessage = "Extension methods have all the capabilities of regular static methods."; + + // Write the string and include the quotation marks. + Console.WriteLine($"\"{factMessage}\""); + + // Default comparisons are case sensitive. + bool containsSearchResult = factMessage.Contains("extension"); + Console.WriteLine($"""Contains "extension"? {containsSearchResult}"""); + + // For user-facing searches, pass a StringComparison value to control case and culture. + bool ignoreCaseSearchResult = factMessage.StartsWith("extension", StringComparison.CurrentCultureIgnoreCase); + Console.WriteLine($"""Starts with "extension"? {ignoreCaseSearchResult} (ignoring case)"""); + + bool endsWithSearchResult = factMessage.EndsWith(".", StringComparison.Ordinal); + Console.WriteLine($"Ends with '.'? {endsWithSearchResult}"); + // => "Extension methods have all the capabilities of regular static methods." + // => Contains "extension"? False + // => Starts with "extension"? True (ignoring case) + // => Ends with '.'? True + // + } + + private static void ContainsChar() + { + // + string path = "/usr/local/bin"; + bool hasSlash = path.Contains('/'); + Console.WriteLine($"Path contains '/': {hasSlash}"); + // => Path contains '/': True + // + } + + private static void IndexOfExample() + { + // + string factMessage = "Extension methods have all the capabilities of regular static methods."; + + Console.WriteLine($"\"{factMessage}\""); + + // Extract the text between the first and last occurrence of "methods". + int first = factMessage.IndexOf("methods") + "methods".Length; + int last = factMessage.LastIndexOf("methods"); + string between = factMessage.Substring(first, last - first); + Console.WriteLine($"""Substring between "methods" and "methods": '{between}'"""); + // => "Extension methods have all the capabilities of regular static methods." + // => Substring between "methods" and "methods": ' have all the capabilities of regular static ' + // + } +} diff --git a/docs/csharp/fundamentals/strings/common-tasks/snippets/search/search.csproj b/docs/csharp/fundamentals/strings/common-tasks/snippets/search/search.csproj new file mode 100644 index 0000000000000..bad583f080c8c --- /dev/null +++ b/docs/csharp/fundamentals/strings/common-tasks/snippets/search/search.csproj @@ -0,0 +1,8 @@ + + + Exe + net10.0 + enable + enable + + diff --git a/docs/csharp/fundamentals/strings/common-tasks/snippets/split/Program.cs b/docs/csharp/fundamentals/strings/common-tasks/snippets/split/Program.cs new file mode 100644 index 0000000000000..0b0f4d8f715b6 --- /dev/null +++ b/docs/csharp/fundamentals/strings/common-tasks/snippets/split/Program.cs @@ -0,0 +1,198 @@ +namespace SplitStrings; + +public static class Program +{ + public static void Main() + { + SplitWords(); + Console.WriteLine(); + IndexWords(); + Console.WriteLine(); + RepeatedSeparators(); + Console.WriteLine(); + MultiChar(); + Console.WriteLine(); + MultiCharGaps(); + Console.WriteLine(); + StringSeparators(); + Console.WriteLine(); + LimitCount(); + Console.WriteLine(); + TrimEntries(); + } + + private static void SplitWords() + { + // + string phrase = "The quick brown fox jumps over the lazy dog."; + string[] words = phrase.Split(' '); + + foreach (var word in words) + { + Console.WriteLine($"<{word}>"); + } + // => + // => + // => + // => + // => + // => + // => + // => + // => + // + } + + private static void IndexWords() + { + // + string phrase = "The quick brown fox jumps over the lazy dog."; + string[] words = phrase.Split(' '); + + for (int i = 0; i < words.Length; i++) + { + Console.WriteLine($"Index {i}: <{words[i]}>"); + } + // => Index 0: + // => Index 1: + // => Index 2: + // => ... + // + } + + private static void RepeatedSeparators() + { + // + string phrase = "The quick brown fox jumps over the lazy dog."; + string[] words = phrase.Split(' '); + + foreach (var word in words) + { + Console.WriteLine($"<{word}>"); + } + // The runs of spaces produce empty entries: + // => + // => + // => + // => <> + // => <> + // => <> + // => + // => ... + // + } + + private static void MultiChar() + { + // + char[] delimiters = [' ', ',', '.', ':', '\t']; + + string text = "one\ttwo three:four,five six seven"; + Console.WriteLine($"Original text: '{text}'"); + + string[] words = text.Split(delimiters); + Console.WriteLine($"{words.Length} words in text:"); + + foreach (var word in words) + { + Console.WriteLine($"<{word}>"); + } + // => 7 words in text: + // => + // => + // => + // => + // => + // => + // => + // + } + + private static void MultiCharGaps() + { + // + char[] delimiters = [' ', ',', '.', ':', '\t']; + + string text = "one\ttwo :,five six seven"; + Console.WriteLine($"Original text: '{text}'"); + + string[] words = text.Split(delimiters); + Console.WriteLine($"{words.Length} words in text:"); + + foreach (var word in words) + { + Console.WriteLine($"<{word}>"); + } + // => 7 words in text: + // => + // => + // => <> + // => <> + // => + // => + // => + // + } + + private static void StringSeparators() + { + // + string[] separators = ["<<", "..."]; + + string text = "one< 3 substrings in text: + // => one + // => two + // => three + } + + private static void LimitCount() + { + // + string phrase = "The quick brown fox jumps over the lazy dog."; + string[] words = phrase.Split(' ', 4, StringSplitOptions.None); + + foreach (var word in words) + { + Console.WriteLine($"<{word}>"); + } + // => + // => + // => + // => + // + } + + private static void TrimEntries() + { + // + string numerals = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"; + string[] trimmed = numerals.Split(',', StringSplitOptions.TrimEntries); + + Console.WriteLine("Trimmed entries:"); + foreach (var word in trimmed) + { + Console.WriteLine($"<{word}>"); + } + + string[] untrimmed = numerals.Split(',', StringSplitOptions.None); + Console.WriteLine("Untrimmed entries:"); + foreach (var word in untrimmed) + { + Console.WriteLine($"<{word}>"); + } + // => Trimmed entries: <1> <2> ... <10> + // => Untrimmed entries: <1> < 2> ... < 10> + // + } +} diff --git a/docs/csharp/fundamentals/strings/common-tasks/snippets/split/split.csproj b/docs/csharp/fundamentals/strings/common-tasks/snippets/split/split.csproj new file mode 100644 index 0000000000000..bad583f080c8c --- /dev/null +++ b/docs/csharp/fundamentals/strings/common-tasks/snippets/split/split.csproj @@ -0,0 +1,8 @@ + + + Exe + net10.0 + enable + enable + + diff --git a/docs/csharp/fundamentals/strings/common-tasks/split.md b/docs/csharp/fundamentals/strings/common-tasks/split.md new file mode 100644 index 0000000000000..4bb7da905da27 --- /dev/null +++ b/docs/csharp/fundamentals/strings/common-tasks/split.md @@ -0,0 +1,80 @@ +--- +title: "Split strings into substrings in C#" +description: Learn how to split a C# string into substrings with String.Split, including how to use multiple separators, limit the substring count, and trim or remove entries. +ms.date: 05/21/2026 +ms.topic: concept-article +ai-usage: ai-assisted +--- + +# Split strings into substrings in C\# + +> [!TIP] +> This article is part of the **Fundamentals** section for developers who already know at least one programming language and are learning C#. If you're new to programming, start with the [Get started](../../../tour-of-csharp/tutorials/index.md) tutorials first. +> +> **Coming from another language?** `string.Split` is C#'s counterpart to Java's `String.split` and JavaScript's `String.prototype.split`. Unlike those languages, C# returns an array (`string[]`), not a list, and the separator argument is a character or string, not a regular expression. For pattern-based splitting, see . + +The method breaks a string into an array of substrings using one or more separators. It's the simplest way to parse delimited text such as words, CSV-style values, or protocol tokens. + +The method has many overloads, but they cover four independent decisions: + +- **Separators**: one `char`, an array of `char`, one `string`, or an array of `string`. +- **Maximum result count**: cap the number of substrings returned. +- **Empty-entry handling**: keep empty substrings (the default) or drop them with . +- **Whitespace handling**: trim leading and trailing whitespace from each entry with . + +## Split a string into words + +To split a phrase on whitespace, pass `' '` as the separator: + +:::code language="csharp" source="snippets/split/Program.cs" id="SplitWords"::: + +Iterate the returned array with `for` to recover the position of each word: + +:::code language="csharp" source="snippets/split/Program.cs" id="IndexWords"::: + +If the input contains repeated instances of the separator character, `Split` produces empty entries, one for each "gap" between consecutive separators: + +:::code language="csharp" source="snippets/split/Program.cs" id="RepeatedSeparators"::: + +Pass `StringSplitOptions.RemoveEmptyEntries` to drop those empty entries, as shown later in this article. + +## Split on multiple separator characters + +When more than one character can act as a separator, pass them as an array. The following example treats spaces, commas, periods, colons, and tabs all as word boundaries: + +:::code language="csharp" source="snippets/split/Program.cs" id="MultiChar"::: + +Adjacent separators still produce empty entries: + +:::code language="csharp" source="snippets/split/Program.cs" id="MultiCharGaps"::: + +## Split on multicharacter separators + +To split on whole-word or multicharacter separators, pass an array of strings. The string-array overloads require a value. Use `RemoveEmptyEntries` when repeated separators would otherwise produce empty results: + +:::code language="csharp" source="snippets/split/Program.cs" id="StringSeparators"::: + +## Limit how many substrings you get back + +Pass a `count` argument to cap the number of results. The final entry holds everything that's left, including any remaining separators: + +:::code language="csharp" source="snippets/split/Program.cs" id="LimitCount"::: + +This pattern is handy for `key=value` pairs and other formats where only the first separator is meaningful. + +## Trim whitespace from each entry + +`StringSplitOptions.TrimEntries` strips leading and trailing whitespace from every returned substring. You can combine it with `RemoveEmptyEntries` for typical CSV-style cleanup: + +:::code language="csharp" source="snippets/split/Program.cs" id="TrimEntries"::: + +## Use regular expressions + +`Split` works well for fixed character or string delimiters. For pattern-based splitting, use . For an introduction to regular expressions on strings, see [String operations](../../../language-reference/builtin-types/string-operations.md). + +## See also + +- +- +- [String operations: pattern matching, performance, and span-based search](../../../language-reference/builtin-types/string-operations.md) +- [Extract elements from a string](../../../../standard/base-types/divide-up-strings.md) diff --git a/docs/csharp/fundamentals/strings/interpolation.md b/docs/csharp/fundamentals/strings/interpolation.md new file mode 100644 index 0000000000000..749671cd60964 --- /dev/null +++ b/docs/csharp/fundamentals/strings/interpolation.md @@ -0,0 +1,101 @@ +--- +title: "String interpolation in C#" +description: Learn how to build result strings in C# with string interpolation by embedding formatted expression results directly in a string literal. +ms.date: 05/21/2026 +ms.topic: concept-article +ai-usage: ai-assisted +--- + +# String interpolation in C\# + +> [!TIP] +> This article is part of the **Fundamentals** section for developers who already know at least one programming language and are learning C#. If you're new to programming, start with the [Get started](../../tour-of-csharp/tutorials/index.md) tutorials first. +> +> **Coming from another language?** String interpolation in C# works much like template literals in JavaScript (`` `${x}` ``) or f-strings in Python (`f"{x}"`). The expression inside `{}` can be any valid C# expression, and you can add format and alignment specifiers without leaving the string. + +*String interpolation* lets you embed expressions directly in a string literal by prefixing the literal with `$`: + +:::code language="csharp" source="snippets/interpolation/Program.cs" id="general"::: + +Each `{ }` is an *interpolation expression*. C# evaluates the expression, converts the result to a string by calling its `ToString()` method, and substitutes the text into the result. The string interpolation for a `null` expression is the empty string. In most cases, the default conversion produces the output you want, and you don't need to do anything more. + +Interpolated strings are a more readable alternative to , and they support the full [composite formatting](../../../standard/base-types/composite-formatting.md) feature set. Anything you can do with a classic positional format string—format specifiers, alignment, culture-aware formatting, and constant strings—you can also do with an interpolated string. The rest of this article covers those options. Reach for them only when you need finer control over the result; otherwise, the plain `$"{expression}"` form is enough. + +For the language-reference treatment of the syntax and the underlying handler types, see [interpolated string](../../language-reference/tokens/interpolated.md) reference. For performance-focused topics such as `Span` interpolation and custom interpolated string handlers, see [String operations](../../language-reference/builtin-types/string-operations.md). + +## Apply a format string + +To control how an expression result is formatted, follow the expression with a colon and a [standard or custom format string](../../../standard/base-types/formatting-types.md): + +```csharp +{:} +``` + +The following example formats a and a value: + +:::code language="csharp" source="snippets/interpolation/Program.cs" id="FormatString"::: + +## Set the field width and alignment + +To produce aligned output, follow the expression with a comma and a minimum field width. Positive widths right-align the value, and negative widths left-align it: + +```csharp +{,} +``` + +:::code language="csharp" source="snippets/interpolation/Program.cs" id="alignment"::: + +When you need both alignment and a format string, put alignment first: + +```csharp +{,:} +``` + +:::code language="csharp" source="snippets/interpolation/Program.cs" id="AlignmentAndFormat"::: + +If the formatted value is longer than the requested width, C# ignores the width and emits the full value. + +## Escape braces and use escape sequences + +Interpolated strings support the same escape sequences as ordinary string literals. To include a literal `{` or `}` character in the result, double it (`{{` or `}}`). + +For paths and other strings that contain backslashes, prefer an [interpolated raw string literal](../../language-reference/tokens/raw-string.md) (`$"""..."""`) over the older verbatim form (`$@"..."`). Raw string literals don't process escape sequences, so backslashes appear as-is: + +:::code language="csharp" source="snippets/interpolation/Program.cs" id="escapes"::: + +## Use a conditional expression + +The colon has special meaning inside an interpolation expression, so wrap a [conditional exoressuin](../../language-reference/operators/conditional-operator.md) in parentheses: + +:::code language="csharp" source="snippets/interpolation/Program.cs" id="conditional"::: + +## Span an expression across multiple lines + +For better readability, break long interpolation expressions across multiple lines. Multi-line interpolation expressions are available since C# 11. The following example adds newlines between the `{` and `}` characters to separate the interpolated expressions from the literal text: + +:::code language="csharp" source="snippets/interpolation/Program.cs" id="newlines"::: + +## Build constant strings + +You can build constant interpolated strings when every interpolated expression is a constant value.That makes it usable for attribute arguments, `switch` patterns, and other contexts that require compile-time constants: + +:::code language="csharp" source="snippets/interpolation/Program.cs" id="ConstantInterpolated"::: + +## Format with a specific culture + +By default, an interpolated string formats values using , which affects date, number, and currency representations. For deterministic output, pass an explicit culture to : + +:::code language="csharp" source="snippets/interpolation/Program.cs" id="culture"::: + +For invariant output (logs, file formats, machine-readable data), pass : + +:::code language="csharp" source="snippets/interpolation/Program.cs" id="invariant"::: + +## See also + +- [Interpolated string token](../../language-reference/tokens/interpolated.md) +- [String operations: pattern matching, performance, and span-based search](../../language-reference/builtin-types/string-operations.md) +- [Composite formatting](../../../standard/base-types/composite-formatting.md) +- [Formatting types in .NET](../../../standard/base-types/formatting-types.md) +- +- diff --git a/docs/csharp/fundamentals/strings/snippets/interpolation/Program.cs b/docs/csharp/fundamentals/strings/snippets/interpolation/Program.cs new file mode 100644 index 0000000000000..310b3c5f5a21c --- /dev/null +++ b/docs/csharp/fundamentals/strings/snippets/interpolation/Program.cs @@ -0,0 +1,180 @@ +using System.Globalization; + +namespace Interpolation; + +public static class Program +{ + public static void Main() + { + General(); + Console.WriteLine(); + FormatString(); + Console.WriteLine(); + Alignment(); + Console.WriteLine(); + AlignmentAndFormat(); + Console.WriteLine(); + Escapes(); + Console.WriteLine(); + Conditional(); + Console.WriteLine(); + Newlines(); + Console.WriteLine(); + ConstantInterpolated(); + Console.WriteLine(); + Culture(); + Console.WriteLine(); + Invariant(); + } + + private static void General() + { + // + double a = 3; + double b = 4; + Console.WriteLine($"Area of the right triangle with legs of {a} and {b} is {0.5 * a * b}"); + Console.WriteLine($"Length of the hypotenuse of the right triangle with legs of {a} and {b} is {CalculateHypotenuse(a, b)}"); + double CalculateHypotenuse(double leg1, double leg2) => Math.Sqrt(leg1 * leg1 + leg2 * leg2); + // => Area of the right triangle with legs of 3 and 4 is 6 + // => Length of the hypotenuse of the right triangle with legs of 3 and 4 is 5 + // + } + + private static void FormatString() + { + // + var date = new DateTime(1731, 11, 25); + Console.WriteLine($"On {date:dddd, MMMM dd, yyyy} L. Euler introduced the letter e to denote {Math.E:F5}."); + // => On Sunday, November 25, 1731 L. Euler introduced the letter e to denote 2.71828. + // + } + + private static void Alignment() + { + // + var titles = new Dictionary() + { + ["Doyle, Arthur Conan"] = "Hound of the Baskervilles, The", + ["London, Jack"] = "Call of the Wild, The", + ["Shakespeare, William"] = "Tempest, The" + }; + + Console.WriteLine("Author and Title List"); + Console.WriteLine(); + Console.WriteLine($"|{"Author",-25}|{"Title",30}|"); + foreach (var title in titles) + { + Console.WriteLine($"|{title.Key,-25}|{title.Value,30}|"); + } + // => Author and Title List + // => + // => |Author | Title| + // => |Doyle, Arthur Conan |Hound of the Baskervilles, The| + // => |London, Jack | Call of the Wild, The| + // => |Shakespeare, William | Tempest, The| + // + } + + private static void AlignmentAndFormat() + { + // + const int NameAlignment = -9; + const int ValueAlignment = 7; + double a = 3; + double b = 4; + Console.WriteLine($"Three classical Pythagorean means of {a} and {b}:"); + Console.WriteLine($"|{"Arithmetic",NameAlignment}|{0.5 * (a + b),ValueAlignment:F3}|"); + Console.WriteLine($"|{"Geometric",NameAlignment}|{Math.Sqrt(a * b),ValueAlignment:F3}|"); + Console.WriteLine($"|{"Harmonic",NameAlignment}|{2 / (1 / a + 1 / b),ValueAlignment:F3}|"); + // => Three classical Pythagorean means of 3 and 4: + // => |Arithmetic| 3.500| + // => |Geometric| 3.464| + // => |Harmonic | 3.429| + // + } + + private static void Escapes() + { + // + int[] xs = [1, 2, 7, 9]; + int[] ys = [7, 9, 12]; + Console.WriteLine($"Find the intersection of the {{{string.Join(", ", xs)}}} and {{{string.Join(", ", ys)}}} sets."); + // => Find the intersection of the {1, 2, 7, 9} and {7, 9, 12} sets. + + var userName = "Jane"; + var stringWithEscapes = $"C:\\Users\\{userName}\\Documents"; + var rawInterpolated = $"""C:\Users\{userName}\Documents"""; + Console.WriteLine(stringWithEscapes); + Console.WriteLine(rawInterpolated); + // => C:\Users\Jane\Documents + // => C:\Users\Jane\Documents + // + } + + private static void Conditional() + { + // + var rand = new Random(42); + for (int i = 0; i < 3; i++) + { + Console.WriteLine($"Coin flip: {(rand.NextDouble() < 0.5 ? "heads" : "tails")}"); + } + // + } + + private static void Newlines() + { + // + int[] numbers = [3, 1, 4, 1, 5, 9, 2, 6]; + Console.WriteLine($"Total: { + numbers.Sum() + }, average: {numbers.Average():F2}."); + // => Total: 31, average: 3.88. + // + } + + private static void ConstantInterpolated() + { + // + const string Audience = "world"; + const string Greeting = $"Hello, {Audience}!"; + Console.WriteLine(Greeting); + // => Hello, world! + // + } + + private static void Culture() + { + // + CultureInfo[] cultures = + [ + CultureInfo.GetCultureInfo("en-US"), + CultureInfo.GetCultureInfo("en-GB"), + CultureInfo.GetCultureInfo("nl-NL"), + CultureInfo.InvariantCulture + ]; + var date = new DateTime(2026, 5, 21, 12, 35, 31); + var number = 31_415_926.536; + foreach (var culture in cultures) + { + var cultureSpecificMessage = string.Create(culture, $"{date,23}{number,20:N3}"); + Console.WriteLine($"{culture.Name,-10}{cultureSpecificMessage}"); + } + // Output is similar to: + // => en-US 5/21/2026 12:35:31 PM 31,415,926.536 + // => en-GB 21/05/2026 12:35:31 31,415,926.536 + // => nl-NL 21-05-2026 12:35:31 31.415.926,536 + // => 05/21/2026 12:35:31 31,415,926.536 + // + } + + private static void Invariant() + { + // + var timestamp = new DateTime(2026, 5, 21, 15, 46, 24); + string message = string.Create(CultureInfo.InvariantCulture, $"Date and time in invariant culture: {timestamp}"); + Console.WriteLine(message); + // => Date and time in invariant culture: 05/21/2026 15:46:24 + // + } +} diff --git a/docs/csharp/fundamentals/strings/snippets/interpolation/interpolation.csproj b/docs/csharp/fundamentals/strings/snippets/interpolation/interpolation.csproj new file mode 100644 index 0000000000000..bad583f080c8c --- /dev/null +++ b/docs/csharp/fundamentals/strings/snippets/interpolation/interpolation.csproj @@ -0,0 +1,8 @@ + + + Exe + net10.0 + enable + enable + + diff --git a/docs/csharp/fundamentals/tutorials/nullable-reference-types.md b/docs/csharp/fundamentals/tutorials/nullable-reference-types.md index d5ea0af2d9eaf..6b2cd16aed837 100644 --- a/docs/csharp/fundamentals/tutorials/nullable-reference-types.md +++ b/docs/csharp/fundamentals/tutorials/nullable-reference-types.md @@ -178,6 +178,6 @@ The finished sample is in the [csharp/NullableIntroduction](https://github.com/d ## Related content - [Nullable reference types](../null-safety/nullable-reference-types.md) -- [Resolve nullable warnings](../null-safety/resolve-warnings.md) +- [Resolve nullable warnings](../null-safety/common-tasks/resolve-warnings.md) - [Nullable migration strategies](../../advanced-topics/update-applications/nullable-migration-strategies.md) - [Working with nullable reference types in EF Core](/ef/core/miscellaneous/nullable-reference-types) diff --git a/docs/csharp/how-to/index.md b/docs/csharp/how-to/index.md index 67bca16daef6d..f381558ba755c 100644 --- a/docs/csharp/how-to/index.md +++ b/docs/csharp/how-to/index.md @@ -44,9 +44,9 @@ Strings are the fundamental data type used to display or manipulate text. These - [Compare strings](compare-strings.md). - [Modify the contents of a string](modify-string-contents.md). - [Determine if a string represents a number](../programming-guide/strings/how-to-determine-whether-a-string-represents-a-numeric-value.md). -- [Use `String.Split` to separate strings](parse-strings-using-split.md). +- [Use `String.Split` to separate strings](../fundamentals/strings/common-tasks/split.md). - [Combine multiple strings into one](concatenate-multiple-strings.md). -- [Search for text in a string](search-strings.md). +- [Search for text in a string](../fundamentals/strings/common-tasks/search.md). ## Convert between types diff --git a/docs/csharp/how-to/modify-string-contents.md b/docs/csharp/how-to/modify-string-contents.md index d6136bcc7d2a3..19b5604da0d80 100644 --- a/docs/csharp/how-to/modify-string-contents.md +++ b/docs/csharp/how-to/modify-string-contents.md @@ -41,7 +41,7 @@ You can remove text from a string using the class to find a pattern in a source string and replace it with proper capitalization. The method takes a function that provides the logic of the replacement as one of its arguments. In this example, that function, `LocalReplaceMatchCase` is a **local function** declared inside the sample method. `LocalReplaceMatchCase` uses the class to build the replacement string with proper capitalization. -Regular expressions are most useful for searching and replacing text that follows a pattern, rather than known text. For more information, see [How to search strings](search-strings.md). The search pattern, "the\s" searches for the word "the" followed by a white-space character. That part of the pattern ensures that it doesn't match "there" in the source string. For more information on regular expression language elements, see [Regular Expression Language - Quick Reference](../../standard/base-types/regular-expression-language-quick-reference.md). +Regular expressions are most useful for searching and replacing text that follows a pattern, rather than known text. For more information, see [Search strings in C#](../fundamentals/strings/common-tasks/search.md). The search pattern, "the\s" searches for the word "the" followed by a white-space character. That part of the pattern ensures that it doesn't match "there" in the source string. For more information on regular expression language elements, see [Regular Expression Language - Quick Reference](../../standard/base-types/regular-expression-language-quick-reference.md). :::code language="csharp" source="./snippets/strings/ModifyStrings.cs" id="Snippet5"::: diff --git a/docs/csharp/how-to/parse-strings-using-split.md b/docs/csharp/how-to/parse-strings-using-split.md deleted file mode 100644 index 444c3161c1e38..0000000000000 --- a/docs/csharp/how-to/parse-strings-using-split.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -title: "Divide strings using String.Split" -description: The Split method returns an array of strings split from a set of delimiters. It's an easy way to extract substrings from a string. -ms.date: 12/05/2025 -helpviewer_keywords: - - "splitting strings [C#]" - - "Split method [C#]" - - "strings [C#], splitting" - - "parse strings" -ms.custom: copilot-scenario-highlight ---- -# How to separate strings using String.Split in C\# - -The method creates an array of substrings by splitting the input string based on one or more delimiters. This method is often the easiest way to separate a string on word boundaries. - -> [!TIP] -> You can use AI assistance to [split a string](#use-ai-to-split-a-string). - -## Split a string into words - -The following code splits a common phrase into an array of strings for each word. - -:::code language="csharp" source="./snippets/strings/ParseStringsUsingSplit.cs" id="Snippet1"::: - -Every instance of a separator character produces a value in the returned array. Since arrays in C# are zero-indexed, each string in the array is indexed from 0 to the value returned by the property minus 1: - -:::code language="csharp" source="./snippets/strings/ParseStringsUsingSplit.cs" id="Snippet1.5"::: - -The has many overloads. These overloads customize the behavior for splitting strings: - -- You can specify separators as `char` values or `string` values. -- You can specify one separator or multiple separators. If you specify multiple separators, they must all be the same type (either `char` or `string`). -- You can specify the maximum number of substrings to return. -- You can specify if repeated separator characters are ignored, or produce empty substrings in the return value. -- You can specify if leading and trailing whitespace is removed from the returned substrings. - -The remaining examples use different overloads to show each of these behaviors. - -For more information about indices, see the [Explore indexes and ranges](../tutorials/ranges-indexes.md) article. - -## Specify multiple separators - - can use multiple separator characters. The following example uses spaces, commas, periods, colons, and tabs as separating characters, which are passed to in an array. The loop at the bottom of the code displays each of the words in the returned array. - -:::code language="csharp" source="./snippets/strings/ParseStringsUsingSplit.cs" id="Snippet3"::: - -Consecutive instances of any separator produce the empty string in the output array: - -:::code language="csharp" source="./snippets/strings/ParseStringsUsingSplit.cs" id="Snippet4"::: - - can take an array of strings (character sequences that act as separators for parsing the target string, instead of single characters). - -:::code language="csharp" source="./snippets/strings/ParseStringsUsingSplit.cs" id="Snippet5"::: - -## Limit output size - -The following example shows how to limit the output to the first four substrings in the source string. - -:::code language="csharp" source="./snippets/strings/ParseStringsUsingSplit.cs" id="Snippet6"::: - -## Remove empty substrings - -Consecutive separator characters produce the empty string as a value in the returned array. You can see how an empty string is created in the following example, which uses the space character as a separator. - -:::code language="csharp" source="./snippets/strings/ParseStringsUsingSplit.cs" id="Snippet2"::: - -This behavior makes it easier for formats like comma-separated values (CSV) files representing tabular data. Consecutive commas represent a blank column. - -You can pass an optional parameter to exclude any empty strings in the returned array. For more complicated processing of the returned collection, you can use [LINQ](../linq/index.md) to manipulate the result sequence. - -## Trim whitespace - -The following example shows the effect of trimming entries: - -:::code language="csharp" source="./snippets/strings/ParseStringsUsingSplit.cs" id="Snippet7"::: - -The untrimmed entries have extra whitespace before the numerals. - -## Use AI to split a string - -You can use AI tools, such as GitHub Copilot, to generate code to split strings using `String.Split` in C#. You can customize the prompt to use strings and delimiters per your requirements. - -The following text shows an example prompt for Copilot Chat: - -```copilot-prompt -Generate C# code to parse and split CSV-style data from user input or external export that isn't well formed. -The input string may contain mixed delimiters (commas, semicolons), inconsistent spacing and empty entries. -Parse the string: accept all valid separators, remove any empty values and trim whitespace from all entries. -Return a clean list of values. -Show example output for the string: " apples, oranges ; bananas, , ;pears". -``` - -Review Copilot's suggestions before applying them. - -For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs). - -## See also - -- [Extract elements from a string](../../standard/base-types/divide-up-strings.md) -- [Strings](../programming-guide/strings/index.md) -- [.NET regular expressions](../../standard/base-types/regular-expressions.md) -- [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) -- [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) diff --git a/docs/csharp/how-to/search-strings.md b/docs/csharp/how-to/search-strings.md deleted file mode 100644 index 53dab76b473ed..0000000000000 --- a/docs/csharp/how-to/search-strings.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: "How to search strings" -description: Learn about two strategies to search for text in strings in C#. String class methods search for specific text. Regular expressions search for patterns in text. -ms.date: 02/18/2025 -helpviewer_keywords: - - "searching strings [C#]" - - "strings [C#], searching with String methods" - - "strings [C#], searching with regular expressions" ---- - -# How to search strings - -You can use two main strategies to search for text in strings. Methods of the class search for specific text. Regular expressions search for patterns in text. - -The [string](../language-reference/builtin-types/reference-types.md#the-string-type) type, which is an alias for the class, provides many useful methods for searching the contents of a string. Among them are , , , , . The class provides a rich vocabulary to search for patterns in text. In this article, you learn these techniques and how to choose the best method for your needs. - -## Does a string contain text? - -The , , and methods search a string for specific text. The following example shows each of these methods and a variation that uses a case-insensitive search: - -:::code language="csharp" source="./snippets/strings/SearchStrings.cs" id="Snippet1"::: - -The preceding example demonstrates an important point for using these methods. Searches are **case-sensitive** by default. You use the enumeration value to specify a case-insensitive search. - -## Where does the sought text occur in a string? - -The and methods also search for text in strings. These methods return the location of the text being sought. If the text isn't found, they return `-1`. The following example shows a search for the first and last occurrence of the word "methods" and displays the text in between. - -:::code language="csharp" source="./snippets/strings/SearchStrings.cs" id="Snippet2"::: - -## Finding specific text using regular expressions - -The class can be used to search strings. These searches can range in complexity from simple to complicated text patterns. - -The following code example searches for the word "the" or "their" in a sentence, ignoring case. The static method performs the search. You give it the string to search and a search pattern. In this case, a third argument specifies case-insensitive search. For more information, see . - -The search pattern describes the text you search for. The following table describes each element of the search pattern. (The following table uses the single `\`, which must be escaped as `\\` in a C# string). - -| Pattern | Meaning | -|----------|----------------------------------| -| `the` | match the text "the" | -| `(eir)?` | match 0 or 1 occurrence of "eir" | -| `\s` | match a white-space character | - -:::code language="csharp" source="./snippets/strings/SearchStrings.cs" id="Snippet3"::: - -> [!TIP] -> The `string` methods are generally better choices when you're searching for an exact string. Regular expressions are better when you're searching for some pattern in a source string. - -## Does a string follow a pattern? - -The following code uses regular expressions to validate the format of each string in an array. The validation requires that each string is formatted as a telephone number: three groups of digits separated by dashes where the first two groups contain three digits and the third group contains four digits. The search pattern uses the regular expression `^\\d{3}-\\d{3}-\\d{4}$`. For more information, see [Regular Expression Language - Quick Reference](../../standard/base-types/regular-expression-language-quick-reference.md). - -| Pattern | Meaning | -|---------|----------------------------------------| -| `^` | Matches the beginning of the string | -| `\d{3}` | Matches exactly three digit characters | -| `-` | Matches the '-' character | -| `\d{4}` | Matches exactly four digit characters | -| `$` | Matches the end of the string | - -:::code language="csharp" source="./snippets/\strings/SearchStrings.cs" id="Snippet4"::: - -This single search pattern matches many valid strings. Regular expressions are better to search for or validate against a pattern, rather than a single text string. - -## See also - -- [Strings](../programming-guide/strings/index.md) -- -- [.NET regular expressions](../../standard/base-types/regular-expressions.md) -- [Regular expression language - quick reference](../../standard/base-types/regular-expression-language-quick-reference.md) -- [Best practices for using strings in .NET](../../standard/base-types/best-practices-strings.md) diff --git a/docs/csharp/how-to/snippets/strings/ParseStringsUsingSplit.cs b/docs/csharp/how-to/snippets/strings/ParseStringsUsingSplit.cs deleted file mode 100644 index 3e09ff2d24cd4..0000000000000 --- a/docs/csharp/how-to/snippets/strings/ParseStringsUsingSplit.cs +++ /dev/null @@ -1,165 +0,0 @@ -namespace HowToStrings; - -public static class ParseStringsUsingSplit -{ - public static void Examples() - { - Console.WriteLine("Split words"); - Console.WriteLine(); - SplitWords(); - - Console.WriteLine("Enumerate words"); - Console.WriteLine(); - EnumerateWords(); - - Console.WriteLine("Split words with repeated separators"); - Console.WriteLine(); - SplitWordsWithRepeatedSeparators(); - - Console.WriteLine("Split on multiple chars"); - Console.WriteLine(); - SplitOnMultipleChars(); - - Console.WriteLine("Split on multiple chars with gaps"); - Console.WriteLine(); - SplitOnMultipleCharsWithGaps(); - - Console.WriteLine("Split using strings"); - Console.WriteLine(); - SplitUsingStrings(); - - Console.WriteLine("Split into no more than four substrings"); - Console.WriteLine(); - SplitFourTimes(); - - Console.WriteLine("Trim output substrings"); - Console.WriteLine(); - SplitAndTrim(); - } - - private static void SplitWords() - { - // - string phrase = "The quick brown fox jumps over the lazy dog."; - string[] words = phrase.Split(' '); - - foreach (var word in words) - { - Console.WriteLine($"<{word}>"); - } - // - } - - private static void EnumerateWords() - { - // - string phrase = "The quick brown fox jumps over the lazy dog."; - string[] words = phrase.Split(' '); - - for (int i = 0; i < words.Length; i++) - { - Console.WriteLine($"Index {i}: <{words[i]}>"); - } - // - } - - private static void SplitWordsWithRepeatedSeparators() - { - // - string phrase = "The quick brown fox jumps over the lazy dog."; - string[] words = phrase.Split(' '); - - foreach (var word in words) - { - Console.WriteLine($"<{word}>"); - } - // - } - - private static void SplitOnMultipleChars() - { - // - char[] delimiterChars = [' ', ',', '.', ':', '\t']; - - string text = "one\ttwo three:four,five six seven"; - Console.WriteLine($"Original text: '{text}'"); - - string[] words = text.Split(delimiterChars); - Console.WriteLine($"{words.Length} words in text:"); - - foreach (var word in words) - { - Console.WriteLine($"<{word}>"); - } - // - } - - private static void SplitOnMultipleCharsWithGaps() - { - // - char[] delimiterChars = [' ', ',', '.', ':', '\t']; - - string text = "one\ttwo :,five six seven"; - Console.WriteLine($"Original text: '{text}'"); - - string[] words = text.Split(delimiterChars); - Console.WriteLine($"{words.Length} words in text:"); - - foreach (var word in words) - { - Console.WriteLine($"<{word}>"); - } - // - } - - private static void SplitUsingStrings() - { - // - string[] separatingStrings = ["<<", "..."]; - - string text = "one< - } - - private static void SplitFourTimes() - { - // - string phrase = "The quick brown fox jumps over the lazy dog."; - string[] words = phrase.Split(' ', 4, StringSplitOptions.None); - - foreach (var word in words) - { - Console.WriteLine($"<{word}>"); - } - // - } - - private static void SplitAndTrim() - { - // - string numerals = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"; - string[] words = numerals.Split(',', StringSplitOptions.TrimEntries); - - Console.WriteLine("Trimmed entries:"); - foreach (var word in words) - { - Console.WriteLine($"<{word}>"); - } - words = numerals.Split(',', StringSplitOptions.None); - Console.WriteLine("Untrimmed entries:"); - foreach (var word in words) - { - Console.WriteLine($"<{word}>"); - } - // - } -} diff --git a/docs/csharp/how-to/snippets/strings/Program.cs b/docs/csharp/how-to/snippets/strings/Program.cs index 78067d0124cfb..d52b0ec4fe6e6 100644 --- a/docs/csharp/how-to/snippets/strings/Program.cs +++ b/docs/csharp/how-to/snippets/strings/Program.cs @@ -1,14 +1,8 @@ using HowToStrings; -Console.WriteLine("============================ String.Split examples ================================================="); -Console.WriteLine(); -ParseStringsUsingSplit.Examples(); Console.WriteLine("============================ String concatenation examples ================================================="); Console.WriteLine(); Concatenate.Examples(); -Console.WriteLine("============================ String Searching examples ================================================="); -Console.WriteLine(); -SearchStrings.Examples(); Console.WriteLine("============================ Modify string examples ================================================="); Console.WriteLine(); ModifyStrings.Examples(); diff --git a/docs/csharp/how-to/snippets/strings/SearchStrings.cs b/docs/csharp/how-to/snippets/strings/SearchStrings.cs deleted file mode 100644 index ce92fe7d03d33..0000000000000 --- a/docs/csharp/how-to/snippets/strings/SearchStrings.cs +++ /dev/null @@ -1,117 +0,0 @@ -namespace HowToStrings; - -public class SearchStrings -{ - public static void Examples() - { - SearchWithMethods(); - SearchByIndex(); - RegularExpressionsOne(); - RegularExpressionsValidation(); - } - - private static void SearchWithMethods() - { - // - string factMessage = "Extension methods have all the capabilities of regular static methods."; - - // Write the string and include the quotation marks. - Console.WriteLine($"\"{factMessage}\""); - - // Simple comparisons are always case sensitive! - bool containsSearchResult = factMessage.Contains("extension"); - // Raw string literals can work here because the output doesn't begin with " - Console.WriteLine($"""Contains "extension"? {containsSearchResult}"""); - - // For user input and strings that will be displayed to the end user, - // use the StringComparison parameter on methods that have it to specify how to match strings. - bool ignoreCaseSearchResult = factMessage.StartsWith("extension", System.StringComparison.CurrentCultureIgnoreCase); - Console.WriteLine($"""Starts with "extension"? {ignoreCaseSearchResult} (ignoring case)"""); - - bool endsWithSearchResult = factMessage.EndsWith(".", System.StringComparison.CurrentCultureIgnoreCase); - Console.WriteLine($"Ends with '.'? {endsWithSearchResult}"); - // - } - - private static void SearchByIndex() - { - // - string factMessage = "Extension methods have all the capabilities of regular static methods."; - - // Write the string and include the quotation marks. - Console.WriteLine($"\"{factMessage}\""); - - // This search returns the substring between two strings, so - // the first index is moved to the character just after the first string. - int first = factMessage.IndexOf("methods") + "methods".Length; - int last = factMessage.LastIndexOf("methods"); - string str2 = factMessage.Substring(first, last - first); - Console.WriteLine($"""Substring between "methods" and "methods": '{str2}'"""); - // - } - - private static void RegularExpressionsOne() - { - // - string[] sentences = - [ - "Put the water over there.", - "They're quite thirsty.", - "Their water bottles broke." - ]; - - string sPattern = "the(ir)?\\s"; - - foreach (string s in sentences) - { - Console.Write($"{s,24}"); - - if (System.Text.RegularExpressions.Regex.IsMatch(s, sPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase)) - { - Console.WriteLine($" (match for '{sPattern}' found)"); - } - else - { - Console.WriteLine(); - } - } - // - } - - private static void RegularExpressionsValidation() - { - // - string[] numbers = - [ - "123-555-0190", - "444-234-22450", - "690-555-0178", - "146-893-232", - "146-555-0122", - "4007-555-0111", - "407-555-0111", - "407-2-5555", - "407-555-8974", - "407-2ab-5555", - "690-555-8148", - "146-893-232-" - ]; - - string sPattern = """^\d{3}-\d{3}-\d{4}$"""; - - foreach (string s in numbers) - { - Console.Write($"{s,14}"); - - if (System.Text.RegularExpressions.Regex.IsMatch(s, sPattern)) - { - Console.WriteLine(" - valid"); - } - else - { - Console.WriteLine(" - invalid"); - } - } - // - } -} diff --git a/docs/csharp/language-reference/builtin-types/snippets/string-operations/Program.cs b/docs/csharp/language-reference/builtin-types/snippets/string-operations/Program.cs new file mode 100644 index 0000000000000..ca166b61bad9c --- /dev/null +++ b/docs/csharp/language-reference/builtin-types/snippets/string-operations/Program.cs @@ -0,0 +1,90 @@ +using System.Text.RegularExpressions; + +namespace StringOperations; + +public static class Program +{ + public static void Main() + { + RegexPattern(); + Console.WriteLine(); + RegexValidate(); + Console.WriteLine(); + SpanSearch(); + } + + private static void RegexPattern() + { + // + string[] sentences = + [ + "Put the water over there.", + "They're quite thirsty.", + "Their water bottles broke." + ]; + + string pattern = @"the(ir)?\s"; + + foreach (string s in sentences) + { + Console.Write($"{s,28}"); + + if (Regex.IsMatch(s, pattern, RegexOptions.IgnoreCase)) + { + Console.WriteLine($" (match for '{pattern}' found)"); + } + else + { + Console.WriteLine(); + } + } + // + } + + private static void RegexValidate() + { + // + string[] numbers = + [ + "123-555-0190", + "444-234-22450", + "690-555-0178", + "146-893-232", + "146-555-0122", + "4007-555-0111", + "407-555-0111", + "407-2-5555", + "407-555-8974", + "407-2ab-5555", + "690-555-8148", + "146-893-232-" + ]; + + string pattern = """^\d{3}-\d{3}-\d{4}$"""; + + foreach (string s in numbers) + { + Console.Write($"{s,14}"); + Console.WriteLine(Regex.IsMatch(s, pattern) ? " - valid" : " - invalid"); + } + // + } + + private static void SpanSearch() + { + // + ReadOnlySpan input = "key1=alpha;key2=beta;key3=gamma".AsSpan(); + ReadOnlySpan needle = "key2=".AsSpan(); + + int start = input.IndexOf(needle); + if (start >= 0) + { + ReadOnlySpan rest = input[(start + needle.Length)..]; + int end = rest.IndexOf(';'); + ReadOnlySpan value = end >= 0 ? rest[..end] : rest; + Console.WriteLine($"key2 = {value}"); + } + // => key2 = beta + // + } +} diff --git a/docs/csharp/language-reference/builtin-types/snippets/string-operations/string-operations.csproj b/docs/csharp/language-reference/builtin-types/snippets/string-operations/string-operations.csproj new file mode 100644 index 0000000000000..bad583f080c8c --- /dev/null +++ b/docs/csharp/language-reference/builtin-types/snippets/string-operations/string-operations.csproj @@ -0,0 +1,8 @@ + + + Exe + net10.0 + enable + enable + + diff --git a/docs/csharp/language-reference/builtin-types/string-operations.md b/docs/csharp/language-reference/builtin-types/string-operations.md new file mode 100644 index 0000000000000..ecbf1b717a751 --- /dev/null +++ b/docs/csharp/language-reference/builtin-types/string-operations.md @@ -0,0 +1,72 @@ +--- +title: "String operations: pattern matching, performance, and span-based search" +description: "Learn how to apply regular-expression patterns to strings, search strings with ReadOnlySpan, and pick the right StringComparison for performance." +ms.topic: reference +ms.date: 05/21/2026 +ai-usage: ai-assisted +--- + +# String operations: Pattern matching, performance, and span-based search + +This article covers three string operations: regular-expression pattern matching with , allocation-free search over , and choosing a value for correct, fast comparisons. + +## Find specific text by using regular expressions + +The class searches strings for patterns rather than fixed substrings. The static method takes the input string, a pattern, and optional flags. + +The following example searches each sentence for the word *the* or *their*, case insensitive. The pattern `the(ir)?\s` matches `the` optionally followed by `ir`, then a whitespace character: + +| Pattern | Meaning | +|----------|----------------------------------| +| `the` | match the literal text `the` | +| `(ir)?` | match 0 or 1 occurrence of `ir` | +| `\s` | match a whitespace character | + +:::code language="csharp" source="snippets/string-operations/Program.cs" id="RegexPattern"::: + +## Validate strings against a pattern + +To check whether an entire input matches a shape, anchor the pattern with `^` and `$`. The following example validates that each string is a US-style telephone number: three digits, three digits, four digits, separated by dashes: + +| Pattern | Meaning | +|---------|----------------------------------------| +| `^` | match the beginning of the string | +| `\d{3}` | match exactly three digit characters | +| `-` | match a literal `-` character | +| `\d{4}` | match exactly four digit characters | +| `$` | match the end of the string | + +:::code language="csharp" source="snippets/string-operations/Program.cs" id="RegexValidate"::: + +For the full pattern syntax, see [Regular expression language - quick reference](../../../standard/base-types/regular-expression-language-quick-reference.md). + +## Choose between `string` methods and regular expressions + +`string` methods and `Regex` solve overlapping problems. Prefer `string` methods when the text you're searching for is a literal value, a known prefix or suffix, or a fixed delimiter. They're simpler to read and faster, because they don't pay the cost of compiling and executing a pattern. Reach for `Regex` when the search target is a *shape*, such as alternations, optional groups, repeated character classes, or anchored validation. As a rule of thumb, if you can write the search as one or two `string.Contains` / `StartsWith` / `IndexOf` calls, do so. + +## Search using `ReadOnlySpan` + +When you parse large inputs or run a search on a hot path, the per-call allocations of `string.Substring` and `string.Split` can dominate. `ReadOnlySpan` gives you a view over an existing string (or array, or stack buffer) without copying, and provides span-based equivalents of the common `string` methods, including : + +:::code language="csharp" source="snippets/string-operations/Program.cs" id="SpanSearch"::: + +Span-based search avoids allocations because the slices (`input[start..]`, `rest[..end]`) are simply windows over the original characters. The same approach scales to parsing key-value lists, headers, and other delimited text without ever calling `Substring`. + +## Performance considerations for `StringComparison` + +Most `string` instance methods have overloads that accept a value. Methods such as default to **ordinal**, but and default to **current culture**. This difference matters in two ways: + +- **Speed.** Ordinal comparison is a byte-for-byte test that runs in tight, vectorized loops. Culture-aware comparison consults a sort table, walks combining characters, and applies locale-specific rules. For the same input, it can be an order of magnitude slower. +- **Correctness.** Culture-aware comparison can fold characters that you don't expect (Turkish `i`/`I`, German `ß` to `ss`, ligatures). This behavior is right for sorting names a user sees but wrong for parsing identifiers, paths, or protocol tokens. + +For machine-defined text, such as file names, URLs, HTTP headers, identifiers, and configuration keys, pass or explicitly. Reserve culture-aware values for natural-language text shown to users. For comprehensive guidance, see [Best practices for comparing strings in .NET](../../../standard/base-types/best-practices-strings.md). + +## See also + +- [Regular expression language — quick reference](../../../standard/base-types/regular-expression-language-quick-reference.md) +- [Best practices for comparing strings in .NET](../../../standard/base-types/best-practices-strings.md) +- [Search strings](../../fundamentals/strings/common-tasks/search.md) +- [Split strings into substrings](../../fundamentals/strings/common-tasks/split.md) +- +- +- diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml index 29fb29f941bae..9f8589a04fb21 100644 --- a/docs/csharp/language-reference/toc.yml +++ b/docs/csharp/language-reference/toc.yml @@ -65,6 +65,9 @@ items: - name: Nullable reference types href: ./builtin-types/nullable-reference-types.md displayName: "? token, ? symbol" + - name: String operations + displayName: regex, ReadOnlySpan, StringComparison + href: ./builtin-types/string-operations.md - name: Collections and arrays items: - name: Collections diff --git a/docs/csharp/programming-guide/strings/index.md b/docs/csharp/programming-guide/strings/index.md index 20d4e754326e8..3b27e55962c76 100644 --- a/docs/csharp/programming-guide/strings/index.md +++ b/docs/csharp/programming-guide/strings/index.md @@ -137,7 +137,7 @@ For more information, see [Composite formatting in .NET](../../../standard/base- ## Substrings -A substring is any sequence of characters that is contained in a string. Use the method to create a new string from a part of the original string. You can search for one or more occurrences of a substring by using the method. Use the method to replace all occurrences of a specified substring with a new string. Like the method, actually returns a new string and doesn't modify the original string. For more information, see [How to search strings](../../how-to/search-strings.md) and [How to modify string contents](../../how-to/modify-string-contents.md). +A substring is any sequence of characters that is contained in a string. Use the method to create a new string from a part of the original string. You can search for one or more occurrences of a substring by using the method. Use the method to replace all occurrences of a specified substring with a new string. Like the method, actually returns a new string and doesn't modify the original string. For more information, see [Search strings in C#](../../fundamentals/strings/common-tasks/search.md) and [How to modify string contents](../../how-to/modify-string-contents.md). :::code language="csharp" source="./snippets/StringCharacters.cs" id="Substrings"::: @@ -184,8 +184,8 @@ Because the type implements method to parse strings. -- [How to search strings](../../how-to/search-strings.md): Explains how to use search for specific text or patterns in strings. +- [Split strings into substrings in C#](../../fundamentals/strings/common-tasks/split.md): Contains code examples that illustrate how to use the method to parse strings. +- [Search strings in C#](../../fundamentals/strings/common-tasks/search.md): Explains how to search for specific text or patterns in strings. - [How to determine whether a string represents a numeric value](./how-to-determine-whether-a-string-represents-a-numeric-value.md): Shows how to safely parse a string to see whether it has a valid numeric value. - [String interpolation](../../language-reference/tokens/interpolated.md): Describes the string interpolation feature that provides a convenient syntax to format strings. - [Using the StringBuilder class in .NET](../../../standard/base-types/stringbuilder.md) diff --git a/docs/csharp/toc.yml b/docs/csharp/toc.yml index f122ed37af35b..e943cb48281bd 100644 --- a/docs/csharp/toc.yml +++ b/docs/csharp/toc.yml @@ -73,7 +73,6 @@ items: href: fundamentals/types/delegates-lambdas.md - name: Anonymous types href: programming-guide/classes-and-structs/anonymous-types.md - # TODO: Delegates, lambdas and events - name: Null safety items: - name: Overview @@ -82,20 +81,28 @@ items: href: fundamentals/null-safety/nullable-value-types.md - name: Nullable reference types href: fundamentals/null-safety/nullable-reference-types.md - - name: Resolve nullable warnings - href: fundamentals/null-safety/resolve-warnings.md - name: Null operators href: fundamentals/null-safety/null-operators.md - - name: "Tutorial: Express your design intent with nullable reference types" - href: fundamentals/tutorials/nullable-reference-types.md + - name: Common tasks + items: + - name: Resolve nullable warnings + href: fundamentals/null-safety/common-tasks/resolve-warnings.md - name: Strings items: - name: Overview href: fundamentals/strings/index.md - name: Raw string literals href: fundamentals/strings/raw-string-literals.md + - name: String interpolation + href: fundamentals/strings/interpolation.md - name: nameof operator href: fundamentals/strings/nameof.md + - name: Common tasks + items: + - name: Search strings + href: fundamentals/strings/common-tasks/search.md + - name: Split strings into substrings + href: fundamentals/strings/common-tasks/split.md - name: Object-oriented programming items: - name: Classes, structs, and records @@ -156,6 +163,8 @@ items: # TODO: Classes and objects (interfaces and classes) # TODO: Generics (methods and classes) # TODO: Fundamentals of using lambdas + - name: Express your design intent with nullable reference types + href: fundamentals/tutorials/nullable-reference-types.md - name: Introduction to classes href: fundamentals/tutorials/classes.md - name: Object-oriented C# @@ -341,12 +350,8 @@ items: - name: Article index displayName: how to's href: how-to/index.md - - name: Split strings into substrings - href: how-to/parse-strings-using-split.md - name: Concatenate strings href: how-to/concatenate-multiple-strings.md - - name: Search strings - href: how-to/search-strings.md - name: Modify string contents href: how-to/modify-string-contents.md - name: Compare strings diff --git a/docs/csharp/tutorials/string-interpolation.md b/docs/csharp/tutorials/string-interpolation.md index fd94d98d9a8c3..ab8e8c082d485 100644 --- a/docs/csharp/tutorials/string-interpolation.md +++ b/docs/csharp/tutorials/string-interpolation.md @@ -1,11 +1,12 @@ --- -title: String interpolation +title: Learn String interpolation description: Learn how to include formatted expression results in a result string in C# with string interpolation. author: pkulikov ms.subservice: fundamentals ms.date: 11/18/2025 +ms.topic: tutorial --- -# String interpolation in C\# +# Tutorial: Learn String interpolation in C\# This tutorial shows you how to use [string interpolation](../language-reference/tokens/interpolated.md) to format and include expression results in a result string. The examples assume that you're familiar with basic C# concepts and .NET type formatting. For more information about formatting types in .NET, see [Formatting types in .NET](../../standard/base-types/formatting-types.md). diff --git a/docs/standard/base-types/divide-up-strings.md b/docs/standard/base-types/divide-up-strings.md index 295edaede453e..b2003aef215c8 100644 --- a/docs/standard/base-types/divide-up-strings.md +++ b/docs/standard/base-types/divide-up-strings.md @@ -132,5 +132,5 @@ The next example uses the index-from-end operator to remove a file extension (th ## See also - [.NET regular expressions](regular-expressions.md) -- [How to parse strings using String.Split in C#](../../csharp/how-to/parse-strings-using-split.md) +- [Split strings into substrings in C#](../../csharp/fundamentals/strings/common-tasks/split.md) - [Indices and ranges (C# guide)](../../csharp/tutorials/ranges-indexes.md)