diff --git a/.openpublishing.redirection.ai.json b/.openpublishing.redirection.ai.json index 2cda8aab7cd31..b1215f1dbffff 100644 --- a/.openpublishing.redirection.ai.json +++ b/.openpublishing.redirection.ai.json @@ -2,15 +2,22 @@ "redirections": [ { "source_path_from_root": "/docs/ai/ai-extensions.md", - "redirect_url": "/dotnet/ai/microsoft-extensions-ai" + "redirect_url": "/dotnet/ai/microsoft-extensions-ai", + "redirect_document_id": true }, { "source_path_from_root": "/docs/ai/conceptual/agents.md", "redirect_url": "/dotnet/ai" }, + { + "source_path_from_root": "/docs/ai/conceptual/evaluation-libraries.md", + "redirect_url": "/dotnet/ai/evaluation/libraries", + "redirect_document_id": true + }, { "source_path_from_root": "/docs/ai/get-started/dotnet-ai-overview.md", - "redirect_url": "/dotnet/ai/overview" + "redirect_url": "/dotnet/ai/overview", + "redirect_document_id": true }, { "source_path_from_root": "/docs/ai/how-to/app-service-db-auth.md", @@ -24,6 +31,11 @@ "source_path_from_root": "/docs/ai/how-to/work-with-local-models.md", "redirect_url": "/dotnet/ai" }, + { + "source_path_from_root": "/docs/ai/quickstarts/evaluate-ai-response.md", + "redirect_url": "/dotnet/ai/evaluation/evaluate-ai-response", + "redirect_document_id": true + }, { "source_path_from_root": "/docs/ai/quickstarts/get-started-azure-openai.md", "redirect_url": "/dotnet/ai/quickstarts/build-chat-app" @@ -38,7 +50,8 @@ }, { "source_path_from_root": "/docs/ai/quickstarts/quickstart-assistants.md", - "redirect_url": "/dotnet/ai/quickstarts/create-assistant" + "redirect_url": "/dotnet/ai/quickstarts/create-assistant", + "redirect_document_id": true }, { "source_path_from_root": "/docs/ai/quickstarts/quickstart-azure-openai-tool.md", @@ -46,19 +59,32 @@ }, { "source_path_from_root": "/docs/ai/quickstarts/quickstart-local-ai.md", - "redirect_url": "/dotnet/ai/quickstarts/chat-local-model" + "redirect_url": "/dotnet/ai/quickstarts/chat-local-model", + "redirect_document_id": true }, { "source_path_from_root": "/docs/ai/quickstarts/quickstart-openai-generate-images.md", - "redirect_url": "/dotnet/ai/quickstarts/generate-images" + "redirect_url": "/dotnet/ai/quickstarts/generate-images", + "redirect_document_id": true }, { "source_path_from_root": "/docs/ai/quickstarts/quickstart-openai-summarize-text.md", - "redirect_url": "/dotnet/ai/quickstarts/prompt-model" + "redirect_url": "/dotnet/ai/quickstarts/prompt-model", + "redirect_document_id": true }, { "source_path_from_root": "/docs/ai/tutorials/llm-eval.md", - "redirect_url": "/dotnet/ai/quickstarts/evaluate-ai-response" + "redirect_url": "/dotnet/ai/evaluation/evaluate-ai-response" + }, + { + "source_path_from_root": "/docs/ai/tutorials/evaluate-safety.md", + "redirect_url": "/dotnet/ai/evaluation/evaluate-safety", + "redirect_document_id": true + }, + { + "source_path_from_root": "/docs/ai/tutorials/evaluate-with-reporting.md", + "redirect_url": "/dotnet/ai/evaluation/evaluate-with-reporting", + "redirect_document_id": true } ] } diff --git a/.openpublishing.redirection.csharp.json b/.openpublishing.redirection.csharp.json index 1dc2c75ffeecf..b98367dfd9bed 100644 --- a/.openpublishing.redirection.csharp.json +++ b/.openpublishing.redirection.csharp.json @@ -46,7 +46,7 @@ }, { "source_path_from_root": "/redirections/proposals/csharp-7.2/conditional-ref.md", - "redirect_url": "/dotnet/csharp/language-reference/language-specification/expressions#1218-conditional-operator" + "redirect_url": "/dotnet/csharp/language-reference/language-specification/expressions#1219-conditional-operator" }, { "source_path_from_root": "/redirections/proposals/csharp-7.2/non-trailing-named-arguments.md", @@ -94,7 +94,7 @@ }, { "source_path_from_root": "/redirections/proposals/csharp-7.3/pattern-based-fixed.md", - "redirect_url": "/dotnet/csharp/language-reference/language-specification/unsafe-code#237-the-fixed-statement" + "redirect_url": "/dotnet/csharp/language-reference/language-specification/unsafe-code#247-the-fixed-statement" }, { "source_path_from_root": "/redirections/proposals/csharp-7.3/ref-local-reassignment.md", @@ -122,7 +122,7 @@ }, { "source_path_from_root": "/redirections/proposals/csharp-8.0/null-coalescing-assignment.md", - "redirect_url": "/dotnet/csharp/language-reference/language-specification/expressions#1221-assignment-operators" + "redirect_url": "/dotnet/csharp/language-reference/language-specification/expressions#1222-assignment-operators" }, { "source_path_from_root": "/redirections/proposals/csharp-8.0/async-streams.md", diff --git a/docfx.json b/docfx.json index 705126f1e19c5..e727064b3baaf 100644 --- a/docfx.json +++ b/docfx.json @@ -77,6 +77,7 @@ "csharp-8.0/readonly-instance-members.md", "csharp-8.0/null-coalescing-assignment.md", "csharp-8.0/async-streams.md", + "csharp-8.0/ranges.md", "csharp-9.0/nullable-reference-types-specification.md", "csharp-9.0/nullable-constructor-analysis.md", "csharp-9.0/nullable-parameter-default-value-analysis.md", @@ -622,6 +623,7 @@ "_csharpstandard/standard/classes.md": "Classes", "_csharpstandard/standard/structs.md": "Structs", "_csharpstandard/standard/arrays.md": "Arrays", + "_csharpstandard/standard/ranges.md": "Indexes and ranges", "_csharpstandard/standard/interfaces.md": "Interfaces", "_csharpstandard/standard/enums.md": "Enums", "_csharpstandard/standard/delegates.md": "Delegates", @@ -635,7 +637,6 @@ "_csharpstandard/standard/Bibliography.md": "Bibliography", "_csharplang/proposals/csharp-8.0/patterns.md": "Recursive pattern matching", "_csharplang/proposals/csharp-8.0/default-interface-methods.md": "Default interface methods", - "_csharplang/proposals/csharp-8.0/ranges.md": "Ranges and indices", "_csharplang/proposals/csharp-8.0/using.md": "Pattern based using and using declarations", "_csharplang/proposals/csharp-9.0/covariant-returns.md": "Covariant return types", "_csharplang/proposals/csharp-9.0/extending-partial-methods.md": "Extending partial methods", @@ -749,7 +750,8 @@ "_csharpstandard/standard/namespaces.md": "This chapter defines namespaces, including how to declare them and how to use them.", "_csharpstandard/standard/classes.md": "This chapter covers class declarations, including all member types that can be included in classes. This includes generic classes as well as non-generic classes.", "_csharpstandard/standard/structs.md": "This chapter defines struct declarations. In many cases, the descriptions are defined using the differences between classes and structs.", - "_csharpstandard/standard/arrays.md": "This chapter defines arrays. It includes the rules for array variance, multi-dimensional arrays and jagged arrays.", + "_csharpstandard/standard/arrays.md": "This chapter defines arrays. It includes the rules for array variance, multi-dimensional arrays, and jagged arrays.", + "_csharpstandard/standard/ranges.md": "This chapter defines the index and range operators for indexing into arrays, strings, and spans.", "_csharpstandard/standard/interfaces.md": "This chapter defines interfaces. This includes interface declarations, implementing interfaces, and explicit interface implementation.", "_csharpstandard/standard/enums.md": "This chapter defines the enum types in C#. Enums create a set of named constants and are represented by an underlying integral set of values.", "_csharpstandard/standard/delegates.md": "This chapter defines delegates, which are objects that hold type safe function pointers.", @@ -763,7 +765,6 @@ "_csharpstandard/standard/Bibliography.md": "This appendix lists external standards referenced in this specification.", "_csharplang/proposals/csharp-8.0/patterns.md": "This feature specification describes recursive pattern matching, where patterns can nest inside other patterns.", "_csharplang/proposals/csharp-8.0/default-interface-methods.md": "This feature specification describe the syntax updates necessary to support default interface methods. This includes declaring bodies in interface declarations, and supporting modifiers on declarations.", - "_csharplang/proposals/csharp-8.0/ranges.md": "This feature specification describes the syntax for ranges and indices, which support indexing individual elements of a sequence or a range of a sequence from the start or end of that sequence.", "_csharplang/proposals/csharp-8.0/using.md": "This feature specification supports pattern based using and using declarations to simplify resource cleanup.", "_csharplang/proposals/csharp-9.0/covariant-returns.md": "This feature specification describes covariant return types, where overriding member declarations can return a type derived from the overridden member declaration.", "_csharplang/proposals/csharp-9.0/extending-partial-methods.md": "This feature specification describes extensions to partial methods. These extensions enable source generators to create or call partial methods.", diff --git a/docs/ai/quickstarts/evaluate-ai-response.md b/docs/ai/evaluation/evaluate-ai-response.md similarity index 89% rename from docs/ai/quickstarts/evaluate-ai-response.md rename to docs/ai/evaluation/evaluate-ai-response.md index e81bbea6c0e7f..5814bd26bbc9d 100644 --- a/docs/ai/quickstarts/evaluate-ai-response.md +++ b/docs/ai/evaluation/evaluate-ai-response.md @@ -10,7 +10,7 @@ ms.topic: quickstart In this quickstart, you create an MSTest app to evaluate the quality of a chat response from an OpenAI model. The test app uses the [Microsoft.Extensions.AI.Evaluation](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation) libraries. > [!NOTE] -> This quickstart demonstrates the simplest usage of the evaluation API. Notably, it doesn't demonstrate use of the [response caching](../conceptual/evaluation-libraries.md#cached-responses) and [reporting](../conceptual/evaluation-libraries.md#reporting) functionality, which are important if you're authoring unit tests that run as part of an "offline" evaluation pipeline. The scenario shown in this quickstart is suitable in use cases such as "online" evaluation of AI responses within production code and logging scores to telemetry, where caching and reporting aren't relevant. For a tutorial that demonstrates the caching and reporting functionality, see [Tutorial: Evaluate a model's response with response caching and reporting](../tutorials/evaluate-with-reporting.md) +> This quickstart demonstrates the simplest usage of the evaluation API. Notably, it doesn't demonstrate use of the [response caching](libraries.md#cached-responses) and [reporting](libraries.md#reporting) functionality, which are important if you're authoring unit tests that run as part of an "offline" evaluation pipeline. The scenario shown in this quickstart is suitable in use cases such as "online" evaluation of AI responses within production code and logging scores to telemetry, where caching and reporting aren't relevant. For a tutorial that demonstrates the caching and reporting functionality, see [Tutorial: Evaluate a model's response with response caching and reporting](evaluate-with-reporting.md) ## Prerequisites @@ -103,4 +103,4 @@ If you no longer need them, delete the Azure OpenAI resource and GPT-4 model dep ## Next steps - Evaluate the responses from different OpenAI models. -- Add response caching and reporting to your evaluation code. For more information, see [Tutorial: Evaluate a model's response with response caching and reporting](../tutorials/evaluate-with-reporting.md). +- Add response caching and reporting to your evaluation code. For more information, see [Tutorial: Evaluate a model's response with response caching and reporting](evaluate-with-reporting.md). diff --git a/docs/ai/tutorials/evaluate-safety.md b/docs/ai/evaluation/evaluate-safety.md similarity index 92% rename from docs/ai/tutorials/evaluate-safety.md rename to docs/ai/evaluation/evaluate-safety.md index 6ae7fc152e7d6..7a0c686130802 100644 --- a/docs/ai/tutorials/evaluate-safety.md +++ b/docs/ai/evaluation/evaluate-safety.md @@ -110,7 +110,7 @@ Complete the following steps to create an MSTest project. > [!NOTE] > This code example passes the LLM as `originalChatClient` to . The reason to include the LLM chat client here is to enable getting a chat response from the LLM, and notably, to enable response caching for it. (If you don't want to cache the LLM's response, you can create a separate, local to fetch the response from the LLM.) Instead of passing a , if you already have a for an LLM from another reporting configuration, you can pass that instead, using the overload. > - > Similarly, if you configure both [LLM-based evaluators](../conceptual/evaluation-libraries.md#quality-evaluators) and [Azure AI Foundry Evaluation service–based evaluators](../conceptual/evaluation-libraries.md#safety-evaluators) in the reporting configuration, you also need to pass the LLM to . Then it returns a that can talk to both types of evaluators. + > Similarly, if you configure both [LLM-based evaluators](libraries.md#quality-evaluators) and [Azure AI Foundry Evaluation service–based evaluators](libraries.md#safety-evaluators) in the reporting configuration, you also need to pass the LLM to . Then it returns a that can talk to both types of evaluators. 1. Add a method to define the [chat options](xref:Microsoft.Extensions.AI.ChatOptions) and ask the model for a response to a given question. @@ -148,6 +148,6 @@ To generate a report to view the evaluation results, see [Generate a report](eva This tutorial covers the basics of evaluating content safety. As you create your test suite, consider the following next steps: -- Configure additional evaluators, such as the [quality evaluators](../conceptual/evaluation-libraries.md#quality-evaluators). For an example, see the AI samples repo [quality and safety evaluation example](https://github.com/dotnet/ai-samples/blob/main/src/microsoft-extensions-ai-evaluation/api/reporting/ReportingExamples.Example10_RunningQualityAndSafetyEvaluatorsTogether.cs). +- Configure additional evaluators, such as the [quality evaluators](libraries.md#quality-evaluators). For an example, see the AI samples repo [quality and safety evaluation example](https://github.com/dotnet/ai-samples/blob/main/src/microsoft-extensions-ai-evaluation/api/reporting/ReportingExamples.Example10_RunningQualityAndSafetyEvaluatorsTogether.cs). - Evaluate the content safety of generated images. For an example, see the AI samples repo [image response example](https://github.com/dotnet/ai-samples/blob/main/src/microsoft-extensions-ai-evaluation/api/reporting/ReportingExamples.Example09_RunningSafetyEvaluatorsAgainstResponsesWithImages.cs). - In real-world evaluations, you might not want to validate individual results, since the LLM responses and evaluation scores can vary over time as your product (and the models used) evolve. You might not want individual evaluation tests to fail and block builds in your CI/CD pipelines when this happens. Instead, in such cases, it might be better to rely on the generated report and track the overall trends for evaluation scores across different scenarios over time (and only fail individual builds in your CI/CD pipelines when there's a significant drop in evaluation scores across multiple different tests). diff --git a/docs/ai/tutorials/evaluate-with-reporting.md b/docs/ai/evaluation/evaluate-with-reporting.md similarity index 98% rename from docs/ai/tutorials/evaluate-with-reporting.md rename to docs/ai/evaluation/evaluate-with-reporting.md index 9f5da35e83a77..63df72c5f3ff3 100644 --- a/docs/ai/tutorials/evaluate-with-reporting.md +++ b/docs/ai/evaluation/evaluate-with-reporting.md @@ -155,6 +155,9 @@ Run the test using your preferred test workflow, for example, by using the CLI c dotnet tool install --local Microsoft.Extensions.AI.Evaluation.Console ``` + > [!TIP] + > You might need to create a manifest file first. For more information about that and installing local tools, see [Local tools](../../core/tools/dotnet-tool-install.md#local-tools). + 1. Generate a report by running the following command: ```dotnetcli diff --git a/docs/ai/conceptual/evaluation-libraries.md b/docs/ai/evaluation/libraries.md similarity index 94% rename from docs/ai/conceptual/evaluation-libraries.md rename to docs/ai/evaluation/libraries.md index 377248b45fa97..9033644d6130a 100644 --- a/docs/ai/conceptual/evaluation-libraries.md +++ b/docs/ai/evaluation/libraries.md @@ -6,14 +6,14 @@ ms.date: 07/24/2025 --- # The Microsoft.Extensions.AI.Evaluation libraries -The Microsoft.Extensions.AI.Evaluation libraries simplify the process of evaluating the quality and accuracy of responses generated by AI models in .NET intelligent apps. Various metrics measure aspects like relevance, truthfulness, coherence, and completeness of the responses. Evaluations are crucial in testing, because they help ensure that the AI model performs as expected and provides reliable and accurate results. +The Microsoft.Extensions.AI.Evaluation libraries simplify the process of evaluating the quality and safety of responses generated by AI models in .NET intelligent apps. Various quality metrics measure aspects like relevance, truthfulness, coherence, and completeness of the responses. Safety metrics measure aspects like hate and unfairness, violence, and sexual content. Evaluations are crucial in testing, because they help ensure that the AI model performs as expected and provides reliable and accurate results. The evaluation libraries, which are built on top of the [Microsoft.Extensions.AI abstractions](../microsoft-extensions-ai.md), are composed of the following NuGet packages: - [📦 Microsoft.Extensions.AI.Evaluation](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation) – Defines the core abstractions and types for supporting evaluation. - [📦 Microsoft.Extensions.AI.Evaluation.NLP](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.NLP) - Contains [evaluators](#nlp-evaluators) that evaluate the similarity of an LLM's response text to one or more reference responses using natural language processing (NLP) metrics. These evaluators aren't LLM or AI-based; they use traditional NLP techniques such as text tokenization and n-gram analysis to evaluate text similarity. - [📦 Microsoft.Extensions.AI.Evaluation.Quality](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Quality) – Contains [evaluators](#quality-evaluators) that assess the quality of LLM responses in an app according to metrics such as relevance and completeness. These evaluators use the LLM directly to perform evaluations. -- [📦 Microsoft.Extensions.AI.Evaluation.Safety](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Safety) – Contains [evaluators](#safety-evaluators), such as the `ProtectedMaterialEvaluator` and `ContentHarmEvaluator`, that use the [Azure AI Foundry](/azure/ai-foundry/) Evaluation service to perform evaluations. +- [📦 Microsoft.Extensions.AI.Evaluation.Safety](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Safety) – Contains [evaluators](#safety-evaluators), such as the `ProtectedMaterialEvaluator` and `ContentHarmEvaluator`, that use the [Azure AI Foundry](/azure/ai-foundry/) evaluation service to perform evaluations. - [📦 Microsoft.Extensions.AI.Evaluation.Reporting](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Reporting) – Contains support for caching LLM responses, storing the results of evaluations, and generating reports from that data. - [📦 Microsoft.Extensions.AI.Evaluation.Reporting.Azure](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Reporting.Azure) - Supports the reporting library with an implementation for caching LLM responses and storing the evaluation results in an [Azure Storage](/azure/storage/common/storage-introduction) container. - [📦 Microsoft.Extensions.AI.Evaluation.Console](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Console) – A command-line tool for generating reports and managing evaluation data. @@ -60,7 +60,7 @@ NLP evaluators evaluate the quality of an LLM response by comparing it to a refe ### Safety evaluators -Safety evaluators check for presence of harmful, inappropriate, or unsafe content in a response. They rely on the Azure AI Foundry Evaluation service, which uses a model that's fine tuned to perform evaluations. +Safety evaluators check for presence of harmful, inappropriate, or unsafe content in a response. They rely on the Azure AI Foundry evaluation service, which uses a model that's fine tuned to perform evaluations. | Evaluator type | Metric | Description | |---------------------------------------------------------------------------|--------------------|-------------| @@ -86,7 +86,7 @@ The library contains support for storing evaluation results and generating repor :::image type="content" source="../media/ai-extensions/pipeline-report.jpg" lightbox="../media/ai-extensions/pipeline-report.jpg" alt-text="Screenshot of an AI evaluation report in an Azure DevOps pipeline."::: -The `dotnet aieval` tool, which ships as part of the `Microsoft.Extensions.AI.Evaluation.Console` package, includes functionality for generating reports and managing the stored evaluation data and cached responses. For more information, see [Generate a report](../tutorials/evaluate-with-reporting.md#generate-a-report). +The `dotnet aieval` tool, which ships as part of the `Microsoft.Extensions.AI.Evaluation.Console` package, includes functionality for generating reports and managing the stored evaluation data and cached responses. For more information, see [Generate a report](evaluate-with-reporting.md#generate-a-report). ## Configuration diff --git a/docs/ai/tutorials/media/evaluation-report.png b/docs/ai/evaluation/media/evaluation-report.png similarity index 100% rename from docs/ai/tutorials/media/evaluation-report.png rename to docs/ai/evaluation/media/evaluation-report.png diff --git a/docs/ai/evaluation/responsible-ai.md b/docs/ai/evaluation/responsible-ai.md new file mode 100644 index 0000000000000..d2279d30b61ea --- /dev/null +++ b/docs/ai/evaluation/responsible-ai.md @@ -0,0 +1,37 @@ +--- +title: Responsible AI with .NET +description: Learn what responsible AI is and how you can use .NET to evaluate the safety of your AI apps. +ms.date: 09/08/2025 +ai-usage: ai-assisted +--- + +# Responsible AI with .NET + +*Responsible AI* refers to the practice of designing, developing, and deploying artificial intelligence systems in a way that is ethical, transparent, and aligned with human values. It emphasizes fairness, accountability, privacy, and safety to ensure that AI technologies benefit individuals and society as a whole. As AI becomes increasingly integrated into applications and decision-making processes, prioritizing responsible AI is of utmost importance. + +Microsoft has identified [six principles](https://www.microsoft.com/ai/responsible-ai) for responsible AI: + +- Fairness +- Reliability and safety +- Privacy and security +- Inclusiveness +- Transparency +- Accountability + +If you're building an AI app with .NET, the [📦 Microsoft.Extensions.AI.Evaluation.Safety](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Safety) package provides evaluators to help ensure that the responses your app generates, both text and image, meet the standards for responsible AI. The evaluators can also detect problematic content in user input. These safety evaluators use the [Azure AI Foundry evaluation service](/azure/ai-foundry/concepts/evaluation-evaluators/risk-safety-evaluators) to perform evaluations. They include metrics for hate and unfairness, groundedness, ungrounded inference of human attributes, and the presence of: + +- Protected material +- Self-harm content +- Sexual content +- Violent content +- Vulnerable code (text-based only) +- Indirect attacks (text-based only) + +For more information about the safety evaluators, see [Safety evaluators](libraries.md#safety-evaluators). To get started with the Microsoft.Extensions.AI.Evaluation.Safety evaluators, see [Tutorial: Evaluate response safety with caching and reporting](evaluate-safety.md). + +## See also + +- [Responsible AI at Microsoft](https://www.microsoft.com/ai/responsible-ai) +- [Training: Embrace responsible AI principles and practices](/training/modules/embrace-responsible-ai-principles-practices/) +- [Azure AI Foundry evaluation service](/azure/ai-foundry/concepts/evaluation-evaluators/risk-safety-evaluators) +- [Azure AI Content Safety](/azure/ai-services/content-safety/overview) diff --git a/docs/ai/quickstarts/snippets/evaluate-ai-responses/MyTests.cs b/docs/ai/evaluation/snippets/evaluate-ai-responses/MyTests.cs similarity index 100% rename from docs/ai/quickstarts/snippets/evaluate-ai-responses/MyTests.cs rename to docs/ai/evaluation/snippets/evaluate-ai-responses/MyTests.cs diff --git a/docs/ai/quickstarts/snippets/evaluate-ai-responses/TestAI.csproj b/docs/ai/evaluation/snippets/evaluate-ai-responses/TestAI.csproj similarity index 100% rename from docs/ai/quickstarts/snippets/evaluate-ai-responses/TestAI.csproj rename to docs/ai/evaluation/snippets/evaluate-ai-responses/TestAI.csproj diff --git a/docs/ai/tutorials/snippets/evaluate-safety/EvaluateResponseSafety.csproj b/docs/ai/evaluation/snippets/evaluate-safety/EvaluateResponseSafety.csproj similarity index 100% rename from docs/ai/tutorials/snippets/evaluate-safety/EvaluateResponseSafety.csproj rename to docs/ai/evaluation/snippets/evaluate-safety/EvaluateResponseSafety.csproj diff --git a/docs/ai/tutorials/snippets/evaluate-safety/MSTestSettings.cs b/docs/ai/evaluation/snippets/evaluate-safety/MSTestSettings.cs similarity index 100% rename from docs/ai/tutorials/snippets/evaluate-safety/MSTestSettings.cs rename to docs/ai/evaluation/snippets/evaluate-safety/MSTestSettings.cs diff --git a/docs/ai/tutorials/snippets/evaluate-safety/MyTests.cs b/docs/ai/evaluation/snippets/evaluate-safety/MyTests.cs similarity index 100% rename from docs/ai/tutorials/snippets/evaluate-safety/MyTests.cs rename to docs/ai/evaluation/snippets/evaluate-safety/MyTests.cs diff --git a/docs/ai/tutorials/snippets/evaluate-with-reporting/MyTests.cs b/docs/ai/evaluation/snippets/evaluate-with-reporting/MyTests.cs similarity index 100% rename from docs/ai/tutorials/snippets/evaluate-with-reporting/MyTests.cs rename to docs/ai/evaluation/snippets/evaluate-with-reporting/MyTests.cs diff --git a/docs/ai/tutorials/snippets/evaluate-with-reporting/TestAIWithReporting.csproj b/docs/ai/evaluation/snippets/evaluate-with-reporting/TestAIWithReporting.csproj similarity index 100% rename from docs/ai/tutorials/snippets/evaluate-with-reporting/TestAIWithReporting.csproj rename to docs/ai/evaluation/snippets/evaluate-with-reporting/TestAIWithReporting.csproj diff --git a/docs/ai/tutorials/snippets/evaluate-with-reporting/WordCountEvaluator.cs b/docs/ai/evaluation/snippets/evaluate-with-reporting/WordCountEvaluator.cs similarity index 100% rename from docs/ai/tutorials/snippets/evaluate-with-reporting/WordCountEvaluator.cs rename to docs/ai/evaluation/snippets/evaluate-with-reporting/WordCountEvaluator.cs diff --git a/docs/ai/toc.yml b/docs/ai/toc.yml index 6f87e87e4daf3..e867cf33701cb 100644 --- a/docs/ai/toc.yml +++ b/docs/ai/toc.yml @@ -83,16 +83,18 @@ items: href: /azure/ai-services/openai/how-to/risks-safety-monitor?toc=/dotnet/ai/toc.json&bc=/dotnet/ai/toc.json - name: Evaluation items: + - name: Responsible AI with .NET + href: evaluation/responsible-ai.md - name: The Microsoft.Extensions.AI.Evaluation libraries - href: conceptual/evaluation-libraries.md + href: evaluation/libraries.md - name: Tutorials items: - name: "Quickstart: Evaluate the quality of a response" - href: quickstarts/evaluate-ai-response.md + href: evaluation/evaluate-ai-response.md - name: "Evaluate response quality with caching and reporting" - href: tutorials/evaluate-with-reporting.md + href: evaluation/evaluate-with-reporting.md - name: "Evaluate response safety with caching and reporting" - href: tutorials/evaluate-safety.md + href: evaluation/evaluate-safety.md - name: Advanced items: - name: Sample interface implementations diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 39fee3b75af44..155dcdbea9cbb 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -203,7 +203,7 @@ | Resource Management - Communication | NuGet [1.2.1](https://www.nuget.org/packages/Azure.ResourceManager.Communication/1.2.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Communication-readme) | GitHub [1.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Communication_1.2.1/sdk/communication/Azure.ResourceManager.Communication/) | | Resource Management - Compute | NuGet [1.11.0](https://www.nuget.org/packages/Azure.ResourceManager.Compute/1.11.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Compute-readme) | GitHub [1.11.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Compute_1.11.0/sdk/compute/Azure.ResourceManager.Compute/) | | Resource Management - Compute Fleet | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.ComputeFleet/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ComputeFleet-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ComputeFleet_1.0.0/sdk/computefleet/Azure.ResourceManager.ComputeFleet/) | -| Resource Management - Compute Schedule | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.ComputeSchedule/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ComputeSchedule-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ComputeSchedule_1.0.0/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/) | +| Resource Management - Compute Schedule | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.ComputeSchedule/1.1.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ComputeSchedule-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ComputeSchedule_1.1.0/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/) | | Resource Management - Confidential Ledger | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.ConfidentialLedger/1.0.1)
NuGet [1.1.0-beta.6](https://www.nuget.org/packages/Azure.ResourceManager.ConfidentialLedger/1.1.0-beta.6) | [docs](/dotnet/api/overview/azure/ResourceManager.ConfidentialLedger-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConfidentialLedger_1.0.1/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/)
GitHub [1.1.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConfidentialLedger_1.1.0-beta.6/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/) | | Resource Management - Confluent | NuGet [1.2.1](https://www.nuget.org/packages/Azure.ResourceManager.Confluent/1.2.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Confluent-readme) | GitHub [1.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Confluent_1.2.1/sdk/confluent/Azure.ResourceManager.Confluent/) | | Resource Management - Connected VMware vSphere | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.ConnectedVMwarevSphere/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ConnectedVMwarevSphere-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConnectedVMwarevSphere_1.1.1/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/) | @@ -406,23 +406,24 @@ | Microsoft.Azure.DataFactoryTestingFramework.Expressions | NuGet [0.2.7](https://www.nuget.org/packages/Microsoft.Azure.DataFactoryTestingFramework.Expressions/0.2.7) | | | | Microsoft.Azure.Functions.Worker.OpenTelemetry | NuGet [1.1.0-preview6](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.OpenTelemetry/1.1.0-preview6) | | | | OpenTelemetry Profiler | NuGet [1.0.0-beta5](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Profiler/1.0.0-beta5) | | | -| Speech CLI | NuGet [1.45.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.CLI/1.45.0) | | | -| Speech Extension Embedded SR | NuGet [1.45.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Embedded.SR/1.45.0) | | | -| Speech Extension Embedded TTS | NuGet [1.45.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Embedded.TTS/1.45.0) | | | -| Speech Extension ONNX Runtime | NuGet [1.45.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.ONNX.Runtime/1.45.0) | | | -| Speech Extension Telemetry | NuGet [1.45.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Telemetry/1.45.0) | | | +| Speech CLI | NuGet [1.46.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.CLI/1.46.0) | | | +| Speech Extension Embedded SR | NuGet [1.46.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Embedded.SR/1.46.0) | | | +| Speech Extension Embedded TTS | NuGet [1.46.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Embedded.TTS/1.46.0) | | | +| Speech Extension ONNX Runtime | NuGet [1.46.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.ONNX.Runtime/1.46.0) | | | +| Speech Extension Telemetry | NuGet [1.46.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Telemetry/1.46.0) | | | | System Net Client Model | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/System.Net.ClientModel/1.0.0-beta.1) | | | | Unknown Display Name | NuGet [0.12.0](https://www.nuget.org/packages/Azure.Iot.Operations.Connector/0.12.0) | | | | Unknown Display Name | NuGet [0.1.2-preview.2](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Aot/0.1.2-preview.2) | | | | Unknown Display Name | NuGet [1.1.2-preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.AzureCosmosDb.Mongo/1.1.2-preview) | | | -| Unknown Display Name | NuGet [1.45.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.MAS/1.45.0) | | | +| Unknown Display Name | NuGet [1.46.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.MAS/1.46.0) | | | | Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Postgres/1.0.0) | | | -| Unknown Display Name | NuGet [0.0.5](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.linux-arm64/0.0.5) | | | -| Unknown Display Name | NuGet [0.0.5](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.linux-x64/0.0.5) | | | -| Unknown Display Name | NuGet [0.0.5](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.osx-arm64/0.0.5) | | | -| Unknown Display Name | NuGet [0.0.5](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.osx-x64/0.0.5) | | | -| Unknown Display Name | NuGet [0.0.5](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.win-arm64/0.0.5) | | | -| Unknown Display Name | NuGet [0.0.5](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.win-x64/0.0.5) | | | +| Unknown Display Name | NuGet [0.0.9](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server/0.0.9) | | | +| Unknown Display Name | NuGet [0.0.9](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.linux-arm64/0.0.9) | | | +| Unknown Display Name | NuGet [0.0.9](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.linux-x64/0.0.9) | | | +| Unknown Display Name | NuGet [0.0.9](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.osx-arm64/0.0.9) | | | +| Unknown Display Name | NuGet [0.0.9](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.osx-x64/0.0.9) | | | +| Unknown Display Name | NuGet [0.0.9](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.win-arm64/0.0.9) | | | +| Unknown Display Name | NuGet [0.0.9](https://www.nuget.org/packages/Microsoft.Template.Mcp.Server.win-x64/0.0.9) | | | | WebJobs Extension MySQL | NuGet [1.0.129](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.MySql/1.0.129) | | | | Anomaly Detector | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.AnomalyDetector/1.0.0) | | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.AnomalyDetector_1.0.0-preview.1/sdk/cognitiveservices/AnomalyDetector) | | App Service | NuGet [0.2.2-alpha](https://www.nuget.org/packages/Microsoft.Azure.AppService/0.2.2-alpha) | | | @@ -490,8 +491,8 @@ | Search - Common | NuGet [10.1.0](https://www.nuget.org/packages/Microsoft.Azure.Search.Common/10.1.0) | | GitHub [10.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Search.Common_10.1.0/sdk/search/Microsoft.Azure.Search.Common/) | | Search - Data | NuGet [10.1.0](https://www.nuget.org/packages/Microsoft.Azure.Search.Data/10.1.0) | | GitHub [10.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Search.Data_10.1.0/sdk/search/Microsoft.Azure.Search.Data/) | | Search - Service | NuGet [10.1.0](https://www.nuget.org/packages/Microsoft.Azure.Search.Service/10.1.0) | | GitHub [10.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Search.Service_10.1.0/sdk/search/Microsoft.Azure.Search.Service/) | -| Speech | NuGet [1.45.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech/1.45.0) | | | -| Speech Remote Conversation | NuGet [1.45.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Remoteconversation/1.45.0) | | | +| Speech | NuGet [1.46.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech/1.46.0) | | | +| Speech Remote Conversation | NuGet [1.46.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Remoteconversation/1.46.0) | | | | Speech Xamarin iOS | NuGet [1.25.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Xamarin.iOS/1.25.0) | | | | Spell Check | NuGet [4.1.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Language.SpellCheck/4.1.0-preview.1) | | GitHub [4.1.0-preview.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Language.SpellCheck_4.1.0-preview.1/sdk/cognitiveservices/Language.SpellCheck) | | Spring Cloud Client | NuGet [2.0.0-preview.3](https://www.nuget.org/packages/Microsoft.Azure.SpringCloud.Client/2.0.0-preview.3) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index bcd32d945b3fe..fa0288fd7214a 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -213,7 +213,7 @@ | Resource Management - Communication | NuGet [1.2.1](https://www.nuget.org/packages/Azure.ResourceManager.Communication/1.2.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Communication-readme) | GitHub [1.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Communication_1.2.1/sdk/communication/Azure.ResourceManager.Communication/) | | Resource Management - Compute | NuGet [1.11.0](https://www.nuget.org/packages/Azure.ResourceManager.Compute/1.11.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Compute-readme) | GitHub [1.11.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Compute_1.11.0/sdk/compute/Azure.ResourceManager.Compute/) | | Resource Management - Compute Fleet | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.ComputeFleet/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ComputeFleet-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ComputeFleet_1.0.0/sdk/computefleet/Azure.ResourceManager.ComputeFleet/) | -| Resource Management - Compute Schedule | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.ComputeSchedule/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ComputeSchedule-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ComputeSchedule_1.0.0/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/) | +| Resource Management - Compute Schedule | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.ComputeSchedule/1.1.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ComputeSchedule-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ComputeSchedule_1.1.0/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/) | | Resource Management - Confidential Ledger | NuGet [1.0.1](https://www.nuget.org/packages/Azure.ResourceManager.ConfidentialLedger/1.0.1)
NuGet [1.1.0-beta.6](https://www.nuget.org/packages/Azure.ResourceManager.ConfidentialLedger/1.1.0-beta.6) | [docs](/dotnet/api/overview/azure/ResourceManager.ConfidentialLedger-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConfidentialLedger_1.0.1/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/)
GitHub [1.1.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConfidentialLedger_1.1.0-beta.6/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/) | | Resource Management - Confluent | NuGet [1.2.1](https://www.nuget.org/packages/Azure.ResourceManager.Confluent/1.2.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Confluent-readme) | GitHub [1.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Confluent_1.2.1/sdk/confluent/Azure.ResourceManager.Confluent/) | | Resource Management - Connected VMware vSphere | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.ConnectedVMwarevSphere/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ConnectedVMwarevSphere-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ConnectedVMwarevSphere_1.1.1/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/) | diff --git a/docs/core/whats-new/dotnet-10/libraries.md b/docs/core/whats-new/dotnet-10/libraries.md index 0dd05b1111fc1..a13b67745eb63 100644 --- a/docs/core/whats-new/dotnet-10/libraries.md +++ b/docs/core/whats-new/dotnet-10/libraries.md @@ -2,14 +2,14 @@ title: What's new in .NET libraries for .NET 10 description: Learn about the updates to the .NET libraries for .NET 10. titleSuffix: "" -ms.date: 08/12/2025 +ms.date: 09/09/2025 ms.topic: whats-new ai-usage: ai-assisted --- # What's new in .NET libraries for .NET 10 -This article describes new features in the .NET libraries for .NET 10. It's been updated for Preview 7. +This article describes new features in the .NET libraries for .NET 10. It's been updated for RC 1. ## Cryptography @@ -111,7 +111,7 @@ private static bool ValidateMLDsaSignature(ReadOnlySpan data, ReadOnlySpan } ``` -The PQC algorithms are available on systems where the system cryptographic libraries are OpenSSL 3.5 (or newer) or Windows CNG with PQC support. Also, the new classes are all marked as [`[Experimental]`](../../../fundamentals/syslib-diagnostics/experimental-overview.md) under diagnostic `SYSLIB5006` until development is complete. +The PQC algorithms are available on systems where the system cryptographic libraries are OpenSSL 3.5 (or newer) or Windows CNG with PQC support. The type isn't marked as `[Experimental]`, but some of its methods are (and will be until the underlying standards are finalized). The , , and classes are marked as `[Experimental]` under diagnostic `SYSLIB5006` until development is complete. #### ML-DSA @@ -140,6 +140,20 @@ private static byte[] SignPreHashSha3_256(MLDsa signingKey, ReadOnlySpan d } ``` +Starting in RC 1, ML-DSA also supports signatures created and verified from an "external" mu value, which provides additional flexibility for advanced cryptographic scenarios: + +```csharp +private static byte[] SignWithExternalMu(MLDsa signingKey, ReadOnlySpan externalMu) +{ + return signingKey.SignMu(externalMu); +} + +private static bool VerifyWithExternalMu(MLDsa verifyingKey, ReadOnlySpan externalMu, ReadOnlySpan signature) +{ + return verifyingKey.VerifyMu(externalMu, signature); +} +``` + #### Composite ML-DSA .NET 10 introduces new types to support [ietf-lamps-pq-composite-sigs](https://datatracker.ietf.org/doc/draft-ietf-lamps-pq-composite-sigs/) (currently at draft 7), including the and types, with implementation of the primitive methods for RSA variants. @@ -217,6 +231,7 @@ The issue arises because LINQ expressions can't handle optional parameters. To a ## Strings - [String normalization APIs to work with span of characters](#string-normalization-apis-to-work-with-span-of-characters) +- [UTF-8 support for hex-string conversion](#utf-8-support-for-hex-string-conversion) ### String normalization APIs to work with span of characters @@ -228,6 +243,17 @@ Unicode string normalization has been supported for a long time, but existing AP - - +### UTF-8 support for hex-string conversion + +.NET 10 adds UTF-8 support for hex-string conversion operations in the class. These new methods provide efficient ways to convert between UTF-8 byte sequences and hexadecimal representations without requiring intermediate string allocations: + +- +- +- +- + +These methods mirror the existing overloads that work with `string` and `ReadOnlySpan`, but operate directly on UTF-8 encoded bytes for improved performance in scenarios where you're already working with UTF-8 data. + ## Collections - [Additional `TryAdd` and `TryGetValue` overloads for `OrderedDictionary`](#additional-tryadd-and-trygetvalue-overloads-for-ordereddictionarytkey-tvalue) @@ -339,6 +365,8 @@ All of this is serialized as JSON in the (format The interface now includes a nongeneric interface, , for operations like accessing and . Slice operations no longer copy data, which improves performance. Additionally, you can access data nongenerically by boxing to `object` when performance isn't critical. +The tensor APIs are now stable and no longer marked as experimental. While the APIs still require referencing the [System.Numerics.Tensors](https://www.nuget.org/packages/System.Numerics.Tensors) NuGet package, they have been thoroughly reviewed and finalized for the .NET 10 release. The types take advantage of C# 14 extension operators to provide arithmetic operations when the underlying type `T` supports the operation. If `T` implements the relevant [generic math](../../../standard/generics/math.md) interfaces, for example, `IAdditionOperators` or `INumber`, the operation is supported. For example, `tensor + tensor` is available for a `Tensor`, but isn't available for a `Tensor`. + ## Options validation - [New AOT-safe constructor for `ValidationContext`](#new-aot-safe-constructor-for-validationcontext) diff --git a/docs/core/whats-new/dotnet-10/overview.md b/docs/core/whats-new/dotnet-10/overview.md index 53f0ad2991675..9ca6deee2cf2c 100644 --- a/docs/core/whats-new/dotnet-10/overview.md +++ b/docs/core/whats-new/dotnet-10/overview.md @@ -2,14 +2,14 @@ title: What's new in .NET 10 description: Learn about the new features introduced in .NET 10 for the runtime, libraries, and SDK. Also find links to what's new in other areas, such as ASP.NET Core. titleSuffix: "" -ms.date: 08/12/2025 +ms.date: 09/09/2025 ms.topic: whats-new ai-usage: ai-assisted --- # What's new in .NET 10 -Learn about the new features in .NET 10 and find links to further documentation. This page has been updated for Preview 7. +Learn about the new features in .NET 10 and find links to further documentation. This page has been updated for RC 1. .NET 10, the successor to [.NET 9](../dotnet-9/overview.md), is [supported for three years](https://dotnet.microsoft.com/platform/support/policy/dotnet-core) as a long-term support (LTS) release. You can [download .NET 10 here](https://get.dot.net/10). diff --git a/docs/core/whats-new/dotnet-10/runtime.md b/docs/core/whats-new/dotnet-10/runtime.md index 174f9937fd37e..b034aad4fe20b 100644 --- a/docs/core/whats-new/dotnet-10/runtime.md +++ b/docs/core/whats-new/dotnet-10/runtime.md @@ -2,13 +2,13 @@ title: What's new in .NET 10 runtime description: Learn about the new features introduced in the .NET 10 runtime. titleSuffix: "" -ms.date: 08/12/2025 +ms.date: 09/09/2025 ms.topic: whats-new ai-usage: ai-assisted --- # What's new in the .NET 10 runtime -This article describes new features and performance improvements in the .NET runtime for .NET 10. It's been updated for Preview 7. +This article describes new features and performance improvements in the .NET runtime for .NET 10. It's been updated for RC 1. ## JIT compiler improvements diff --git a/docs/core/whats-new/dotnet-10/sdk.md b/docs/core/whats-new/dotnet-10/sdk.md index a1896e19fa72f..fe69b4d997255 100644 --- a/docs/core/whats-new/dotnet-10/sdk.md +++ b/docs/core/whats-new/dotnet-10/sdk.md @@ -2,14 +2,14 @@ title: What's new in the SDK and tooling for .NET 10 description: Learn about the new .NET SDK features introduced in .NET 10. titleSuffix: "" -ms.date: 08/12/2025 +ms.date: 09/09/2025 ms.topic: whats-new ai-usage: ai-assisted --- # What's new in the SDK and tooling for .NET 10 -This article describes new features and enhancements in the .NET SDK for .NET 10. It's been updated for Preview 7. +This article describes new features and enhancements in the .NET SDK for .NET 10. It's been updated for RC 1. ## .NET tools enhancements diff --git a/docs/csharp/advanced-topics/reflection-and-attributes/index.md b/docs/csharp/advanced-topics/reflection-and-attributes/index.md index 3314666324872..06958d4c026ae 100644 --- a/docs/csharp/advanced-topics/reflection-and-attributes/index.md +++ b/docs/csharp/advanced-topics/reflection-and-attributes/index.md @@ -113,7 +113,7 @@ For example, the following code shows three equivalent `DllImport` attributes: [DllImport("user32.dll", ExactSpelling=false, SetLastError=false)] ``` -The first parameter, the DLL name, is positional and always comes first. The other instances are named parameters. In this scenario, both named parameters default to false, so they can be omitted. Refer to the individual attribute's documentation for information on default parameter values. For more information on allowed parameter types, see the [Attributes](~/_csharpstandard/standard/attributes.md#2224-attribute-parameter-types) section of the [C# language specification](~/_csharpstandard/standard/README.md). +The first parameter, the DLL name, is positional and always comes first. The other instances are named parameters. In this scenario, both named parameters default to false, so they can be omitted. Refer to the individual attribute's documentation for information on default parameter values. For more information on allowed parameter types, see the [Attributes](~/_csharpstandard/standard/attributes.md#2324-attribute-parameter-types) section of the [C# language specification](~/_csharpstandard/standard/README.md). ### Attribute targets diff --git a/docs/csharp/asynchronous-programming/async-return-types.md b/docs/csharp/asynchronous-programming/async-return-types.md index c88d6fb9243f6..b0c8387cdb2c3 100644 --- a/docs/csharp/asynchronous-programming/async-return-types.md +++ b/docs/csharp/asynchronous-programming/async-return-types.md @@ -73,7 +73,7 @@ The following example shows the behavior of an async event handler. In the examp An async method can return any type that has an accessible `GetAwaiter` method that returns an instance of an *awaiter type*. In addition, the returned type must match the type of the parameter of `SetResult` and returned type of the `Task` property on the type specified by the attribute. You can learn more in the article on [Attributes read by the compiler](../language-reference/attributes/general.md#asyncmethodbuilder-attribute) or the C# spec for the [Task type builder pattern](~/_csharpstandard/standard/classes.md#15142-task-type-builder-pattern). -This feature is the complement to [awaitable expressions](~/_csharpstandard/standard/expressions.md#12982-awaitable-expressions), which describes the requirements for the operand of `await`. Generalized async return types enable the compiler to generate `async` methods that return different types. Generalized async return types enabled performance improvements in the .NET libraries. Because and are reference types, memory allocation in performance-critical paths, particularly when allocations occur in tight loops, can adversely affect performance. Support for generalized return types means that you can return a lightweight value type instead of a reference type to avoid more memory allocations. +This feature is the complement to [awaitable expressions](~/_csharpstandard/standard/expressions.md#12992-awaitable-expressions), which describes the requirements for the operand of `await`. Generalized async return types enable the compiler to generate `async` methods that return different types. Generalized async return types enabled performance improvements in the .NET libraries. Because and are reference types, memory allocation in performance-critical paths, particularly when allocations occur in tight loops, can adversely affect performance. Support for generalized return types means that you can return a lightweight value type instead of a reference type to avoid more memory allocations. .NET provides the structure as a lightweight implementation of a generalized task-returning value. The following example uses the structure to retrieve the value of two dice rolls. diff --git a/docs/csharp/language-reference/builtin-types/enum.md b/docs/csharp/language-reference/builtin-types/enum.md index 236c8958cc45a..55a3f86ce7737 100644 --- a/docs/csharp/language-reference/builtin-types/enum.md +++ b/docs/csharp/language-reference/builtin-types/enum.md @@ -87,9 +87,9 @@ For any enumeration type, there exist [boxing and unboxing](../../programming-gu For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md): - [Enums](~/_csharpstandard/standard/enums.md) -- [Enum values and operations](~/_csharpstandard/standard/enums.md#196-enum-values-and-operations) -- [Enumeration logical operators](~/_csharpstandard/standard/expressions.md#12133-enumeration-logical-operators) -- [Enumeration comparison operators](~/_csharpstandard/standard/expressions.md#12126-enumeration-comparison-operators) +- [Enum values and operations](~/_csharpstandard/standard/enums.md#206-enum-values-and-operations) +- [Enumeration logical operators](~/_csharpstandard/standard/expressions.md#12143-enumeration-logical-operators) +- [Enumeration comparison operators](~/_csharpstandard/standard/expressions.md#12136-enumeration-comparison-operators) - [Explicit enumeration conversions](~/_csharpstandard/standard/conversions.md#1033-explicit-enumeration-conversions) - [Implicit enumeration conversions](~/_csharpstandard/standard/conversions.md#1024-implicit-enumeration-conversions) diff --git a/docs/csharp/language-reference/builtin-types/unmanaged-types.md b/docs/csharp/language-reference/builtin-types/unmanaged-types.md index 97e30d813e70b..b7a9852b409fc 100644 --- a/docs/csharp/language-reference/builtin-types/unmanaged-types.md +++ b/docs/csharp/language-reference/builtin-types/unmanaged-types.md @@ -27,7 +27,7 @@ A generic struct may be the source of both unmanaged and managed constructed typ ## C# language specification -For more information, see the [Pointer types](~/_csharpstandard/standard/unsafe-code.md#233-pointer-types) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Pointer types](~/_csharpstandard/standard/unsafe-code.md#243-pointer-types) section of the [C# language specification](~/_csharpstandard/standard/README.md). ## See also diff --git a/docs/csharp/language-reference/keywords/const.md b/docs/csharp/language-reference/keywords/const.md index abce400e9d4f4..4f940157f2f32 100644 --- a/docs/csharp/language-reference/keywords/const.md +++ b/docs/csharp/language-reference/keywords/const.md @@ -63,7 +63,7 @@ The following example demonstrates how to declare a local constant: For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md): - [Constants](~/_csharpstandard/standard/classes.md#154-constants) -- [Constant expressions](~/_csharpstandard/standard/expressions.md#1223-constant-expressions) +- [Constant expressions](~/_csharpstandard/standard/expressions.md#1224-constant-expressions) ## See also diff --git a/docs/csharp/language-reference/operators/addition-operator.md b/docs/csharp/language-reference/operators/addition-operator.md index 9bced4a3457d1..d17c85579c35a 100644 --- a/docs/csharp/language-reference/operators/addition-operator.md +++ b/docs/csharp/language-reference/operators/addition-operator.md @@ -72,7 +72,7 @@ A user-defined type can [overload](operator-overloading.md) the `+` operator. Wh ## C# language specification -For more information, see the [Unary plus operator](~/_csharpstandard/standard/expressions.md#1292-unary-plus-operator) and [Addition operator](~/_csharpstandard/standard/expressions.md#12105-addition-operator) sections of the [C# language specification](~/_csharpstandard/standard/README.md). For more information on overloading the compound assignment operators in C# 14 and later, see the [user defined compound assignment](~/_csharplang/proposals/csharp-14.0/user-defined-compound-assignment.md) feature specification. +For more information, see the [Unary plus operator](~/_csharpstandard/standard/expressions.md#1292-unary-plus-operator) and [Addition operator](~/_csharpstandard/standard/expressions.md#12115-addition-operator) sections of the [C# language specification](~/_csharpstandard/standard/README.md). For more information on overloading the compound assignment operators in C# 14 and later, see the [user defined compound assignment](~/_csharplang/proposals/csharp-14.0/user-defined-compound-assignment.md) feature specification. ## See also diff --git a/docs/csharp/language-reference/operators/arithmetic-operators.md b/docs/csharp/language-reference/operators/arithmetic-operators.md index ddb2a74d2f169..19340e3d067c5 100644 --- a/docs/csharp/language-reference/operators/arithmetic-operators.md +++ b/docs/csharp/language-reference/operators/arithmetic-operators.md @@ -138,7 +138,7 @@ For the `float` and `double` operands, the result of `x % y` for the finite `x` > [!NOTE] > This method of computing the remainder is analogous to the method used for integer operands, but different from the IEEE 754 specification. If you need the remainder operation that complies with the IEEE 754 specification, use the method. -For information about the behavior of the `%` operator with non-finite operands, see the [Remainder operator](~/_csharpstandard/standard/expressions.md#12104-remainder-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For information about the behavior of the `%` operator with non-finite operands, see the [Remainder operator](~/_csharpstandard/standard/expressions.md#12114-remainder-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md). For the `decimal` operands, the remainder operator `%` is equivalent to the [remainder operator]() of the type. @@ -279,15 +279,15 @@ You can use the `checked` modifier only when you overload any of the following o For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md): - [Postfix increment and decrement operators](~/_csharpstandard/standard/expressions.md#12816-postfix-increment-and-decrement-operators) -- [Prefix increment and decrement operators](~/_csharpstandard/standard/expressions.md#1296-prefix-increment-and-decrement-operators) +- [Prefix increment and decrement operators](~/_csharpstandard/standard/expressions.md#1297-prefix-increment-and-decrement-operators) - [Unary plus operator](~/_csharpstandard/standard/expressions.md#1292-unary-plus-operator) - [Unary minus operator](~/_csharpstandard/standard/expressions.md#1293-unary-minus-operator) -- [Multiplication operator](~/_csharpstandard/standard/expressions.md#12102-multiplication-operator) -- [Division operator](~/_csharpstandard/standard/expressions.md#12103-division-operator) -- [Remainder operator](~/_csharpstandard/standard/expressions.md#12104-remainder-operator) -- [Addition operator](~/_csharpstandard/standard/expressions.md#12105-addition-operator) -- [Subtraction operator](~/_csharpstandard/standard/expressions.md#12106-subtraction-operator) -- [Compound assignment](~/_csharpstandard/standard/expressions.md#12214-compound-assignment) +- [Multiplication operator](~/_csharpstandard/standard/expressions.md#12112-multiplication-operator) +- [Division operator](~/_csharpstandard/standard/expressions.md#12113-division-operator) +- [Remainder operator](~/_csharpstandard/standard/expressions.md#12114-remainder-operator) +- [Addition operator](~/_csharpstandard/standard/expressions.md#12115-addition-operator) +- [Subtraction operator](~/_csharpstandard/standard/expressions.md#12116-subtraction-operator) +- [Compound assignment](~/_csharpstandard/standard/expressions.md#12224-compound-assignment) - [The checked and unchecked operators](~/_csharpstandard/standard/expressions.md#12820-the-checked-and-unchecked-operators) - [Numeric promotions](~/_csharpstandard/standard/expressions.md#1247-numeric-promotions) - [User defined compound assignment](~/_csharplang/proposals/csharp-14.0/user-defined-compound-assignment.md) diff --git a/docs/csharp/language-reference/operators/assignment-operator.md b/docs/csharp/language-reference/operators/assignment-operator.md index d5c47a98de594..2bdf08a57ea6b 100644 --- a/docs/csharp/language-reference/operators/assignment-operator.md +++ b/docs/csharp/language-reference/operators/assignment-operator.md @@ -81,7 +81,7 @@ If a user-defined type overloads a binary operator `op`, the `op=` operator, if ## C# language specification -For more information, see the [Assignment operators](~/_csharpstandard/standard/expressions.md#1221-assignment-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md) and the [User defined compound assignment](~/_csharplang/proposals/csharp-14.0/user-defined-compound-assignment.md) feature specification. +For more information, see the [Assignment operators](~/_csharpstandard/standard/expressions.md#1222-assignment-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md) and the [User defined compound assignment](~/_csharplang/proposals/csharp-14.0/user-defined-compound-assignment.md) feature specification. ## See also diff --git a/docs/csharp/language-reference/operators/await.md b/docs/csharp/language-reference/operators/await.md index ac4d2609c01d2..24c70c7a43f9c 100644 --- a/docs/csharp/language-reference/operators/await.md +++ b/docs/csharp/language-reference/operators/await.md @@ -16,7 +16,7 @@ In the following example, the , , , or . However, any awaitable expression can be the operand of the `await` operator. For more information, see the [Awaitable expressions](~/_csharpstandard/standard/expressions.md#12982-awaitable-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). +The operand of the `await` operator is usually of one of the following .NET types: , , , or . However, any awaitable expression can be the operand of the `await` operator. For more information, see the [Awaitable expressions](~/_csharpstandard/standard/expressions.md#12992-awaitable-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). The type of expression `await t` is `TResult` if the type of expression `t` is or . If the type of `t` is or , the type of `await t` is `void`. In both cases, if `t` throws an exception, `await t` rethrows the exception. @@ -41,7 +41,7 @@ The [`Main` method](../../fundamentals/program-structure/main-command-line.md), ## C# language specification -For more information, see the [Await expressions](~/_csharpstandard/standard/expressions.md#1298-await-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Await expressions](~/_csharpstandard/standard/expressions.md#1299-await-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). ## See also diff --git a/docs/csharp/language-reference/operators/bitwise-and-shift-operators.md b/docs/csharp/language-reference/operators/bitwise-and-shift-operators.md index bc5bb6ca730d0..95a1102d5c306 100644 --- a/docs/csharp/language-reference/operators/bitwise-and-shift-operators.md +++ b/docs/csharp/language-reference/operators/bitwise-and-shift-operators.md @@ -195,9 +195,9 @@ If a user-defined type `T` overloads the `<<`, `>>`, or `>>>` operator, the type For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md): - [Bitwise complement operator](~/_csharpstandard/standard/expressions.md#1295-bitwise-complement-operator) -- [Shift operators](~/_csharpstandard/standard/expressions.md#1211-shift-operators) -- [Logical operators](~/_csharpstandard/standard/expressions.md#1213-logical-operators) -- [Compound assignment](~/_csharpstandard/standard/expressions.md#12214-compound-assignment) +- [Shift operators](~/_csharpstandard/standard/expressions.md#1212-shift-operators) +- [Logical operators](~/_csharpstandard/standard/expressions.md#1214-logical-operators) +- [Compound assignment](~/_csharpstandard/standard/expressions.md#12224-compound-assignment) - [Numeric promotions](~/_csharpstandard/standard/expressions.md#1247-numeric-promotions) - [C# 11 - Relaxed shift requirements](~/_csharplang/proposals/csharp-11.0/relaxing_shift_operator_requirements.md) - [C# 11 - Logical right-shift operator](~/_csharplang/proposals/csharp-11.0/unsigned-right-shift-operator.md) diff --git a/docs/csharp/language-reference/operators/boolean-logical-operators.md b/docs/csharp/language-reference/operators/boolean-logical-operators.md index 751c63970a1c8..6bce21c600369 100644 --- a/docs/csharp/language-reference/operators/boolean-logical-operators.md +++ b/docs/csharp/language-reference/operators/boolean-logical-operators.md @@ -184,16 +184,16 @@ For the complete list of C# operators ordered by precedence level, see the [Oper A user-defined type can [overload](operator-overloading.md) the `!`, `&`, `|`, and `^` operators. When a binary operator is overloaded, the corresponding compound assignment operator is also implicitly overloaded. Beginning with C# 14, a user-defined type can explicitly overload the compound assignment operators to provide a more efficient implementation. Typically, a type overloads these operators because the value can be updated in place, rather than allocating a new instance to hold the result of the binary operation. If a type doesn't provide an explicit overload, the compiler generates the implicit overload. -A user-defined type can't overload the conditional logical operators `&&` and `||`. However, if a user-defined type overloads the [true and false operators](true-false-operators.md) and the `&` or `|` operator in a certain way, the `&&` or `||` operation, respectively, can be evaluated for the operands of that type. For more information, see the [User-defined conditional logical operators](~/_csharpstandard/standard/expressions.md#12143-user-defined-conditional-logical-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). +A user-defined type can't overload the conditional logical operators `&&` and `||`. However, if a user-defined type overloads the [true and false operators](true-false-operators.md) and the `&` or `|` operator in a certain way, the `&&` or `||` operation, respectively, can be evaluated for the operands of that type. For more information, see the [User-defined conditional logical operators](~/_csharpstandard/standard/expressions.md#12153-user-defined-conditional-logical-operators ) section of the [C# language specification](~/_csharpstandard/standard/README.md). ## C# language specification For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md): - [Logical negation operator](~/_csharpstandard/standard/expressions.md#1294-logical-negation-operator) -- [Logical operators](~/_csharpstandard/standard/expressions.md#1213-logical-operators) -- [Conditional logical operators](~/_csharpstandard/standard/expressions.md#1214-conditional-logical-operators) -- [Compound assignment](~/_csharpstandard/standard/expressions.md#12214-compound-assignment) +- [Logical operators](~/_csharpstandard/standard/expressions.md#1214-logical-operators) +- [Conditional logical operators](~/_csharpstandard/standard/expressions.md#1215-conditional-logical-operators) +- [Compound assignment](~/_csharpstandard/standard/expressions.md#12224-compound-assignment) - [User defined compound assignment](~/_csharplang/proposals/csharp-14.0/user-defined-compound-assignment.md) ## See also diff --git a/docs/csharp/language-reference/operators/comparison-operators.md b/docs/csharp/language-reference/operators/comparison-operators.md index 0b194758d2c00..736e9c84f765f 100644 --- a/docs/csharp/language-reference/operators/comparison-operators.md +++ b/docs/csharp/language-reference/operators/comparison-operators.md @@ -65,7 +65,7 @@ If a type overloads one of the `<` or `>` operators, it must overload both `<` a ## C# language specification -For more information, see the [Relational and type-testing operators](~/_csharpstandard/standard/expressions.md#1212-relational-and-type-testing-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Relational and type-testing operators](~/_csharpstandard/standard/expressions.md#1213-relational-and-type-testing-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). ## See also diff --git a/docs/csharp/language-reference/operators/conditional-operator.md b/docs/csharp/language-reference/operators/conditional-operator.md index 3b7a1c0d25596..88f35bd3fdfa4 100644 --- a/docs/csharp/language-reference/operators/conditional-operator.md +++ b/docs/csharp/language-reference/operators/conditional-operator.md @@ -79,7 +79,7 @@ A user-defined type can't overload the conditional operator. ## C# language specification -For more information, see the [Conditional operator](~/_csharpstandard/standard/expressions.md#1218-conditional-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Conditional operator](~/_csharpstandard/standard/expressions.md#1219-conditional-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md). Specifications for newer features are: diff --git a/docs/csharp/language-reference/operators/delegate-operator.md b/docs/csharp/language-reference/operators/delegate-operator.md index 577908cb15bfc..e0b995b259fa8 100644 --- a/docs/csharp/language-reference/operators/delegate-operator.md +++ b/docs/csharp/language-reference/operators/delegate-operator.md @@ -57,7 +57,7 @@ Action a = () => StaticFunction(); ## C# language specification -For more information, see the [Anonymous function expressions](~/_csharpstandard/standard/expressions.md#1219-anonymous-function-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Anonymous function expressions](~/_csharpstandard/standard/expressions.md#1220-anonymous-function-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). ## See also diff --git a/docs/csharp/language-reference/operators/equality-operators.md b/docs/csharp/language-reference/operators/equality-operators.md index 081b5253798bf..7abe34a036f3f 100644 --- a/docs/csharp/language-reference/operators/equality-operators.md +++ b/docs/csharp/language-reference/operators/equality-operators.md @@ -76,7 +76,7 @@ Two [delegate](../../programming-guide/delegates/index.md) operands of the same :::code language="csharp" interactive="try-dotnet-method" source="snippets/shared/EqualityOperators.cs" id="SnippetCheckReceiver"::: -For more information, see the [Delegate equality operators](~/_csharpstandard/standard/expressions.md#12129-delegate-equality-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Delegate equality operators](~/_csharpstandard/standard/expressions.md#12139-delegate-equality-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). Delegates that are produced from evaluation of semantically identical [lambda expressions](lambda-expressions.md) aren't equal, as the following example shows: @@ -102,7 +102,7 @@ public virtual bool Equals(T? other); ## C# language specification -For more information, see the [Relational and type-testing operators](~/_csharpstandard/standard/expressions.md#1212-relational-and-type-testing-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Relational and type-testing operators](~/_csharpstandard/standard/expressions.md#1213-relational-and-type-testing-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). For more information about equality of record types, see the [Equality members](~/_csharplang/proposals/csharp-9.0/records.md#equality-members) section of the [records feature proposal note](~/_csharplang/proposals/csharp-9.0/records.md). diff --git a/docs/csharp/language-reference/operators/is.md b/docs/csharp/language-reference/operators/is.md index 9b711ddeae71f..fbbba7271d9ad 100644 --- a/docs/csharp/language-reference/operators/is.md +++ b/docs/csharp/language-reference/operators/is.md @@ -43,7 +43,7 @@ The `is` operator can be useful in the following scenarios: ## C# language specification -For more information, see [The is operator](~/_csharpstandard/standard/expressions.md#121212-the-is-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md) and [Pattern matching](/dotnet/csharp/language-reference/language-specification/patterns). +For more information, see [The is operator](~/_csharpstandard/standard/expressions.md#121312-the-is-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md) and [Pattern matching](/dotnet/csharp/language-reference/language-specification/patterns). ## See also diff --git a/docs/csharp/language-reference/operators/lambda-expressions.md b/docs/csharp/language-reference/operators/lambda-expressions.md index 1b8bd39687187..684f68211bd78 100644 --- a/docs/csharp/language-reference/operators/lambda-expressions.md +++ b/docs/csharp/language-reference/operators/lambda-expressions.md @@ -323,7 +323,7 @@ A static lambda can't capture local variables or instance state from enclosing s ## C# language specification -For more information, see the [Anonymous function expressions](~/_csharpstandard/standard/expressions.md#1219-anonymous-function-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Anonymous function expressions](~/_csharpstandard/standard/expressions.md#1220-anonymous-function-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). For more information about these features, see the following feature proposal notes: diff --git a/docs/csharp/language-reference/operators/lambda-operator.md b/docs/csharp/language-reference/operators/lambda-operator.md index 2adbcdc8998ac..87b4e0ce07c31 100644 --- a/docs/csharp/language-reference/operators/lambda-operator.md +++ b/docs/csharp/language-reference/operators/lambda-operator.md @@ -72,7 +72,7 @@ The `=>` operator can't be overloaded. ## C# language specification -For more information about the lambda operator, see the [Anonymous function expressions](~/_csharpstandard/standard/expressions.md#1219-anonymous-function-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information about the lambda operator, see the [Anonymous function expressions](~/_csharpstandard/standard/expressions.md#1220-anonymous-function-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). ## See also diff --git a/docs/csharp/language-reference/operators/member-access-operators.md b/docs/csharp/language-reference/operators/member-access-operators.md index 3d9d4f999ee7d..f86f54f164c6b 100644 --- a/docs/csharp/language-reference/operators/member-access-operators.md +++ b/docs/csharp/language-reference/operators/member-access-operators.md @@ -271,7 +271,7 @@ For more information, see the following sections of the [C# language specificati - [Null-conditional member access](~/_csharpstandard/standard/expressions.md#1288-null-conditional-member-access) - [Invocation expressions](~/_csharpstandard/standard/expressions.md#12810-invocation-expressions) -For more information about indices and ranges, see the [feature proposal note](~/_csharplang/proposals/csharp-8.0/ranges.md). +For more information about indices and ranges, see the [feature proposal note](~/_csharpstandard/standard/ranges.md). ## See also diff --git a/docs/csharp/language-reference/operators/null-coalescing-operator.md b/docs/csharp/language-reference/operators/null-coalescing-operator.md index fdf464e33c070..709cee25fb479 100644 --- a/docs/csharp/language-reference/operators/null-coalescing-operator.md +++ b/docs/csharp/language-reference/operators/null-coalescing-operator.md @@ -82,7 +82,7 @@ The operators `??` and `??=` can't be overloaded. ## C# language specification -For more information about the `??` operator, see [The null coalescing operator](~/_csharpstandard/standard/expressions.md#1215-the-null-coalescing-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information about the `??` operator, see [The null coalescing operator](~/_csharpstandard/standard/expressions.md#1216-the-null-coalescing-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md). For more information about the `??=` operator, see the [feature proposal note](~/_csharplang/proposals/csharp-8.0/null-coalescing-assignment.md). diff --git a/docs/csharp/language-reference/operators/operator-overloading.md b/docs/csharp/language-reference/operators/operator-overloading.md index d99257a9fcf5d..7247452e65830 100644 --- a/docs/csharp/language-reference/operators/operator-overloading.md +++ b/docs/csharp/language-reference/operators/operator-overloading.md @@ -59,7 +59,7 @@ The following table shows the operators that can't be overloaded: | Operators | Alternatives | | :---------: | --------------- | -|[`x && y`](boolean-logical-operators.md#conditional-logical-and-operator-), [x || y](boolean-logical-operators.md#conditional-logical-or-operator-)| Overload both the [`true`](true-false-operators.md) and [`false`](true-false-operators.md) operators and the [`&`](boolean-logical-operators.md#logical-and-operator-) or [|](boolean-logical-operators.md#logical-or-operator-) operators. For more information, see [User-defined conditional logical operators](~/_csharpstandard/standard/expressions.md#12143-user-defined-conditional-logical-operators).| +|[`x && y`](boolean-logical-operators.md#conditional-logical-and-operator-), [x || y](boolean-logical-operators.md#conditional-logical-or-operator-)| Overload both the [`true`](true-false-operators.md) and [`false`](true-false-operators.md) operators and the [`&`](boolean-logical-operators.md#logical-and-operator-) or [|](boolean-logical-operators.md#logical-or-operator-) operators. For more information, see [User-defined conditional logical operators](~/_csharpstandard/standard/expressions.md#12153-user-defined-conditional-logical-operators ).| |[a[i]](member-access-operators.md#indexer-operator-), [`a?[i]`](member-access-operators.md#null-conditional-operators--and-)|Define an [indexer](../../programming-guide/indexers/index.md).| |[`(T)x`](type-testing-and-cast.md#cast-expression)|Define custom type conversions performed by a cast expression. For more information, see [User-defined conversion operators](user-defined-conversion-operators.md).| |[`^x`](member-access-operators.md#index-from-end-operator-), [`x = y`](assignment-operator.md), [`x.y`](member-access-operators.md#member-access-expression-), [`x?.y`](member-access-operators.md#null-conditional-operators--and-), [`c ? t : f`](conditional-operator.md), [`x ?? y`](null-coalescing-operator.md), [`??= y`](null-coalescing-operator.md),
[`x..y`](member-access-operators.md#range-operator-), [`x->y`](pointer-related-operators.md#pointer-member-access-operator--), [`=>`](lambda-operator.md), [`f(x)`](member-access-operators.md#invocation-expression-), [`as`](type-testing-and-cast.md#the-as-operator), [`await`](await.md), [`checked`](../statements/checked-and-unchecked.md), [`unchecked`](../statements/checked-and-unchecked.md), [`default`](default.md), [`delegate`](delegate-operator.md), [`is`](type-testing-and-cast.md#the-is-operator), [`nameof`](nameof.md), [`new`](new-operator.md),
[`sizeof`](sizeof.md), [`stackalloc`](stackalloc.md), [`switch`](switch-expression.md), [`typeof`](type-testing-and-cast.md#the-typeof-operator), [`with`](with-expression.md)|None.| diff --git a/docs/csharp/language-reference/operators/pointer-related-operators.md b/docs/csharp/language-reference/operators/pointer-related-operators.md index 8d41a0c5543a0..cc0dc939c1ba3 100644 --- a/docs/csharp/language-reference/operators/pointer-related-operators.md +++ b/docs/csharp/language-reference/operators/pointer-related-operators.md @@ -50,7 +50,7 @@ The operand of the `&` operator must be a fixed variable. *Fixed* variables are You can't get the address of a constant or a value. -For more information about fixed and movable variables, see the [Fixed and moveable variables](~/_csharpstandard/standard/unsafe-code.md#234-fixed-and-moveable-variables) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information about fixed and movable variables, see the [Fixed and moveable variables](~/_csharpstandard/standard/unsafe-code.md#244-fixed-and-moveable-variables) section of the [C# language specification](~/_csharpstandard/standard/README.md). The binary `&` operator computes the [logical AND](boolean-logical-operators.md#logical-and-operator-) of its Boolean operands or the [bitwise logical AND](bitwise-and-shift-operators.md#logical-and-operator-) of its integral operands. @@ -172,14 +172,14 @@ A user-defined type can't overload the pointer related operators `&`, `*`, `->`, For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md): -- [Fixed and moveable variables](~/_csharpstandard/standard/unsafe-code.md#234-fixed-and-moveable-variables) -- [The address-of operator](~/_csharpstandard/standard/unsafe-code.md#2365-the-address-of-operator) -- [Pointer indirection](~/_csharpstandard/standard/unsafe-code.md#2362-pointer-indirection) -- [Pointer member access](~/_csharpstandard/standard/unsafe-code.md#2363-pointer-member-access) -- [Pointer element access](~/_csharpstandard/standard/unsafe-code.md#2364-pointer-element-access) -- [Pointer arithmetic](~/_csharpstandard/standard/unsafe-code.md#2367-pointer-arithmetic) -- [Pointer increment and decrement](~/_csharpstandard/standard/unsafe-code.md#2366-pointer-increment-and-decrement) -- [Pointer comparison](~/_csharpstandard/standard/unsafe-code.md#2368-pointer-comparison) +- [Fixed and moveable variables](~/_csharpstandard/standard/unsafe-code.md#244-fixed-and-moveable-variables) +- [The address-of operator](~/_csharpstandard/standard/unsafe-code.md#2465-the-address-of-operator) +- [Pointer indirection](~/_csharpstandard/standard/unsafe-code.md#2462-pointer-indirection) +- [Pointer member access](~/_csharpstandard/standard/unsafe-code.md#2463-pointer-member-access) +- [Pointer element access](~/_csharpstandard/standard/unsafe-code.md#2464-pointer-element-access) +- [Pointer arithmetic](~/_csharpstandard/standard/unsafe-code.md#2467-pointer-arithmetic) +- [Pointer increment and decrement](~/_csharpstandard/standard/unsafe-code.md#2466-pointer-increment-and-decrement) +- [Pointer comparison](~/_csharpstandard/standard/unsafe-code.md#2468-pointer-comparison) ## See also diff --git a/docs/csharp/language-reference/operators/sizeof.md b/docs/csharp/language-reference/operators/sizeof.md index 8ce45f912157a..aa6b4d8a9e4e8 100644 --- a/docs/csharp/language-reference/operators/sizeof.md +++ b/docs/csharp/language-reference/operators/sizeof.md @@ -46,7 +46,7 @@ In unsafe code, when the argument is a managed type, the `sizeof` operator retur ## C# language specification -For more information, see [The sizeof operator](~/_csharpstandard/standard/unsafe-code.md#2369-the-sizeof-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see [The sizeof operator](~/_csharpstandard/standard/unsafe-code.md#2469-the-sizeof-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md). ## See also diff --git a/docs/csharp/language-reference/operators/stackalloc.md b/docs/csharp/language-reference/operators/stackalloc.md index edec7417fa8e9..c346c40261315 100644 --- a/docs/csharp/language-reference/operators/stackalloc.md +++ b/docs/csharp/language-reference/operators/stackalloc.md @@ -66,7 +66,7 @@ The use of `stackalloc` automatically enables buffer overrun detection features ## C# language specification -For more information, see the [Stack allocation](~/_csharpstandard/standard/unsafe-code.md#239-stack-allocation) section of the [C# language specification](~/_csharpstandard/standard/README.md). +For more information, see the [Stack allocation](~/_csharpstandard/standard/unsafe-code.md#249-stack-allocation) section of the [C# language specification](~/_csharpstandard/standard/README.md). ## See also diff --git a/docs/csharp/language-reference/operators/subtraction-operator.md b/docs/csharp/language-reference/operators/subtraction-operator.md index bebeeaaa0ce0b..c65aa465f978d 100644 --- a/docs/csharp/language-reference/operators/subtraction-operator.md +++ b/docs/csharp/language-reference/operators/subtraction-operator.md @@ -31,7 +31,7 @@ For operands of the same [delegate](../builtin-types/reference-types.md#the-dele :::code interactive="try-dotnet-method" language="csharp" source="snippets/shared/SubtractionOperator.cs" id="DelegateRemovalNoChange"::: - The preceding example also demonstrates that during delegate removal delegate instances are compared. For example, delegates that are produced from evaluation of identical [lambda expressions](lambda-expressions.md) aren't equal. For more information about delegate equality, see the [Delegate equality operators](~/_csharpstandard/standard/expressions.md#12129-delegate-equality-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). + The preceding example also demonstrates that during delegate removal delegate instances are compared. For example, delegates that are produced from evaluation of identical [lambda expressions](lambda-expressions.md) aren't equal. For more information about delegate equality, see the [Delegate equality operators](~/_csharpstandard/standard/expressions.md#12139-delegate-equality-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). - If the left-hand operand is `null`, the result of the operation is `null`. If the right-hand operand is `null`, the result of the operation is the left-hand operand. @@ -69,7 +69,7 @@ A user-defined type can [overload](operator-overloading.md) the `-` operator. Wh ## C# language specification -For more information, see the [Unary minus operator](~/_csharpstandard/standard/expressions.md#1293-unary-minus-operator) and [Subtraction operator](~/_csharpstandard/standard/expressions.md#12106-subtraction-operator) sections of the [C# language specification](~/_csharpstandard/standard/README.md). For more information on overloading the compound assignment operators in C# 14 and later, see the [user defined compound assignment](~/_csharplang/proposals/csharp-14.0/user-defined-compound-assignment.md) feature specification. +For more information, see the [Unary minus operator](~/_csharpstandard/standard/expressions.md#1293-unary-minus-operator) and [Subtraction operator](~/_csharpstandard/standard/expressions.md#12116-subtraction-operator) sections of the [C# language specification](~/_csharpstandard/standard/README.md). For more information on overloading the compound assignment operators in C# 14 and later, see the [user defined compound assignment](~/_csharplang/proposals/csharp-14.0/user-defined-compound-assignment.md) feature specification. ## See also diff --git a/docs/csharp/language-reference/operators/true-false-operators.md b/docs/csharp/language-reference/operators/true-false-operators.md index 1fdfa4669a124..ccdf47829b525 100644 --- a/docs/csharp/language-reference/operators/true-false-operators.md +++ b/docs/csharp/language-reference/operators/true-false-operators.md @@ -21,11 +21,11 @@ The `true` and `false` operators aren't guaranteed to complement each other. Tha ## Boolean expressions -A type with the defined `true` operator can be the type of a result of a controlling conditional expression in the [if](../statements/selection-statements.md#the-if-statement), [do](../statements/iteration-statements.md#the-do-statement), [while](../statements/iteration-statements.md#the-while-statement), and [for](../statements/iteration-statements.md#the-for-statement) statements and in the [conditional operator `?:`](conditional-operator.md). For more information, see the [Boolean expressions](~/_csharpstandard/standard/expressions.md#1224-boolean-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). +A type with the defined `true` operator can be the type of a result of a controlling conditional expression in the [if](../statements/selection-statements.md#the-if-statement), [do](../statements/iteration-statements.md#the-do-statement), [while](../statements/iteration-statements.md#the-while-statement), and [for](../statements/iteration-statements.md#the-for-statement) statements and in the [conditional operator `?:`](conditional-operator.md). For more information, see the [Boolean expressions](~/_csharpstandard/standard/expressions.md#1225-boolean-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md). ## User-defined conditional logical operators -If a type with the defined `true` and `false` operators [overloads](operator-overloading.md) the [logical OR operator](boolean-logical-operators.md#logical-or-operator-) `|` or the [logical AND operator](boolean-logical-operators.md#logical-and-operator-) `&` in a certain way, the [conditional logical OR operator](boolean-logical-operators.md#conditional-logical-or-operator-) `||` or [conditional logical AND operator](boolean-logical-operators.md#conditional-logical-and-operator-) `&&`, respectively, can be evaluated for the operands of that type. For more information, see the [User-defined conditional logical operators](~/_csharpstandard/standard/expressions.md#12143-user-defined-conditional-logical-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). +If a type with the defined `true` and `false` operators [overloads](operator-overloading.md) the [logical OR operator](boolean-logical-operators.md#logical-or-operator-) `|` or the [logical AND operator](boolean-logical-operators.md#logical-and-operator-) `&` in a certain way, the [conditional logical OR operator](boolean-logical-operators.md#conditional-logical-or-operator-) `||` or [conditional logical AND operator](boolean-logical-operators.md#conditional-logical-and-operator-) `&&`, respectively, can be evaluated for the operands of that type. For more information, see the [User-defined conditional logical operators](~/_csharpstandard/standard/expressions.md#12153-user-defined-conditional-logical-operators ) section of the [C# language specification](~/_csharpstandard/standard/README.md). ## Example diff --git a/docs/csharp/language-reference/operators/type-testing-and-cast.md b/docs/csharp/language-reference/operators/type-testing-and-cast.md index 4df9e94f4f547..abdd3bb962328 100644 --- a/docs/csharp/language-reference/operators/type-testing-and-cast.md +++ b/docs/csharp/language-reference/operators/type-testing-and-cast.md @@ -145,9 +145,9 @@ A user-defined type can't overload the `()` operator, but can define custom type For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md): -- [The `is` operator](~/_csharpstandard/standard/expressions.md#121212-the-is-operator) -- [The `as` operator](~/_csharpstandard/standard/expressions.md#121213-the-as-operator) -- [Cast expressions](~/_csharpstandard/standard/expressions.md#1297-cast-expressions) +- [The `is` operator](~/_csharpstandard/standard/expressions.md#121312-the-is-operator) +- [The `as` operator](~/_csharpstandard/standard/expressions.md#121313-the-as-operator) +- [Cast expressions](~/_csharpstandard/standard/expressions.md#1298-cast-expressions) - [The `typeof` operator](~/_csharpstandard/standard/expressions.md#12818-the-typeof-operator) ## See also diff --git a/docs/csharp/language-reference/statements/exception-handling-statements.md b/docs/csharp/language-reference/statements/exception-handling-statements.md index cdcfe5f89e328..5148bf610ec1c 100644 --- a/docs/csharp/language-reference/statements/exception-handling-statements.md +++ b/docs/csharp/language-reference/statements/exception-handling-statements.md @@ -42,7 +42,7 @@ Inside a [`catch` block](#the-try-catch-statement), you can use a `throw;` state > [!NOTE] > `throw;` preserves the original stack trace of the exception, which is stored in the property. Opposite to that, `throw e;` updates the property of `e`. -When an exception is thrown, the common language runtime (CLR) looks for the [`catch` block](#the-try-catch-statement) that can handle this exception. If the currently executed method doesn't contain such a `catch` block, the CLR looks at the method that called the current method, and so on up the call stack. If no `catch` block is found, the CLR terminates the executing thread. For more information, see the [How exceptions are handled](~/_csharpstandard/standard/exceptions.md#214-how-exceptions-are-handled) section of the [C# language specification](~/_csharpstandard/standard/README.md). +When an exception is thrown, the common language runtime (CLR) looks for the [`catch` block](#the-try-catch-statement) that can handle this exception. If the currently executed method doesn't contain such a `catch` block, the CLR looks at the method that called the current method, and so on up the call stack. If no `catch` block is found, the CLR terminates the executing thread. For more information, see the [How exceptions are handled](~/_csharpstandard/standard/exceptions.md#224-how-exceptions-are-handled) section of the [C# language specification](~/_csharpstandard/standard/README.md). ### The `throw` expression diff --git a/docs/csharp/language-reference/statements/fixed.md b/docs/csharp/language-reference/statements/fixed.md index 153c82bb11f55..569534311728b 100644 --- a/docs/csharp/language-reference/statements/fixed.md +++ b/docs/csharp/language-reference/statements/fixed.md @@ -49,8 +49,8 @@ You can also use the `fixed` keyword to declare a [fixed-size buffer](../unsafe- For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md): -- [The fixed statement](~/_csharpstandard/standard/unsafe-code.md#237-the-fixed-statement) -- [Fixed and moveable variables](~/_csharpstandard/standard/unsafe-code.md#234-fixed-and-moveable-variables) +- [The fixed statement](~/_csharpstandard/standard/unsafe-code.md#247-the-fixed-statement) +- [Fixed and moveable variables](~/_csharpstandard/standard/unsafe-code.md#244-fixed-and-moveable-variables) ## See also diff --git a/docs/csharp/linq/index.md b/docs/csharp/linq/index.md index 94a8bbf3bdb4c..d3ba24ae757db 100644 --- a/docs/csharp/linq/index.md +++ b/docs/csharp/linq/index.md @@ -22,7 +22,7 @@ You might need to add a [`using`](../language-reference/keywords/using-directive - Query expressions use many familiar C# language constructs, which make them easy to read. - The variables in a query expression are all strongly typed. - A query isn't executed until you iterate over the query variable, for example in a `foreach` statement. -- At compile time, query expressions are converted to standard query operator method calls according to the rules defined in the C# specification. Any query that can be expressed by using query syntax can also be expressed by using method syntax. In some cases, query syntax is more readable and concise. In others, method syntax is more readable. There's no semantic or performance difference between the two different forms. For more information, see [C# language specification](~/_csharpstandard/standard/expressions.md#1220-query-expressions) and [Standard query operators overview](standard-query-operators/index.md). +- At compile time, query expressions are converted to standard query operator method calls according to the rules defined in the C# specification. Any query that can be expressed by using query syntax can also be expressed by using method syntax. In some cases, query syntax is more readable and concise. In others, method syntax is more readable. There's no semantic or performance difference between the two different forms. For more information, see [C# language specification](~/_csharpstandard/standard/expressions.md#1221-query-expressions) and [Standard query operators overview](standard-query-operators/index.md). - Some query operations, such as or , have no equivalent query expression clause and must therefore be expressed as a method call. Method syntax can be combined with query syntax in various ways. - Query expressions can be compiled to expression trees or to delegates, depending on the type that the query is applied to. queries are compiled to delegates. and queries are compiled to expression trees. For more information, see [Expression trees](/dotnet/csharp/advanced-topics/expression-trees). diff --git a/docs/csharp/misc/cs0217.md b/docs/csharp/misc/cs0217.md index ec8fff9d8acec..e0bb38ad888cb 100644 --- a/docs/csharp/misc/cs0217.md +++ b/docs/csharp/misc/cs0217.md @@ -12,7 +12,7 @@ ms.assetid: ede61095-6e11-4f4a-8e7d-85e7a3f4fc3d In order to be applicable as a short circuit operator a user-defined logical operator ('operator') must have the same return type as the type of its 2 parameters. - If you define an operator for a user-defined type, and then try to use the operator as a short-circuit operator, the user-defined operator must have parameters and return values of the same type. For more information about short-circuit operators, see [`&&` operator](../language-reference/operators/boolean-logical-operators.md#conditional-logical-and-operator-) and [`||` operator](../language-reference/operators/boolean-logical-operators.md#conditional-logical-or-operator-). For more information about user-defined short-circuit, or conditional, operators, see the [User-defined conditional logical operators](~/_csharpstandard/standard/expressions.md#12143-user-defined-conditional-logical-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md). + If you define an operator for a user-defined type, and then try to use the operator as a short-circuit operator, the user-defined operator must have parameters and return values of the same type. For more information about short-circuit operators, see [`&&` operator](../language-reference/operators/boolean-logical-operators.md#conditional-logical-and-operator-) and [`||` operator](../language-reference/operators/boolean-logical-operators.md#conditional-logical-or-operator-). For more information about user-defined short-circuit, or conditional, operators, see the [User-defined conditional logical operators](~/_csharpstandard/standard/expressions.md#12153-user-defined-conditional-logical-operators ) section of the [C# language specification](~/_csharpstandard/standard/README.md). The following sample generates CS0217: diff --git a/docs/csharp/specification/toc.yml b/docs/csharp/specification/toc.yml index 8fe28a6c16ea9..a033831d1fa95 100644 --- a/docs/csharp/specification/toc.yml +++ b/docs/csharp/specification/toc.yml @@ -137,8 +137,6 @@ items: href: ../../../_csharplang/proposals/csharp-11.0/list-patterns.md - name: Expressions items: - - name: Ranges - href: ../../../_csharplang/proposals/csharp-8.0/ranges.md - name: Target-typed new expressions href: ../../../_csharplang/proposals/csharp-9.0/target-typed-new.md - name: Target-typed conditional expression diff --git a/docs/csharp/tutorials/ranges-indexes.md b/docs/csharp/tutorials/ranges-indexes.md index bbf4521a379d0..2327bc2ffb38e 100644 --- a/docs/csharp/tutorials/ranges-indexes.md +++ b/docs/csharp/tutorials/ranges-indexes.md @@ -83,7 +83,7 @@ Any type that provides an [indexer](../programming-guide/indexers/index.md) with > > In addition to the time complexity, this causes extra allocations and copies, impacting performance. In performance sensitive code, consider using `Span` or `Memory` as the sequence type, since the range operator does not allocate for them. -A type is **countable** if it has a property named `Length` or `Count` with an accessible getter and a return type of `int`. A countable type that doesn't explicitly support indices or ranges may provide an implicit support for them. For more information, see the [Implicit Index support](~/_csharplang/proposals/csharp-8.0/ranges.md#implicit-index-support) and [Implicit Range support](~/_csharplang/proposals/csharp-8.0/ranges.md#implicit-range-support) sections of the [feature proposal note](~/_csharplang/proposals/csharp-8.0/ranges.md). Ranges using implicit range support return the same sequence type as the source sequence. +A type is **countable** if it has a property named `Length` or `Count` with an accessible getter and a return type of `int`. A countable type that doesn't explicitly support indices or ranges may provide an implicit support for them. For more information, see the [Implicit Index support](~/_csharpstandard/standard/ranges.md#1842-implicit-index-support) and [Implicit Range support](~/_csharpstandard/standard/ranges.md#1843-implicit-range-support) sections of the [feature proposal note](~/_csharpstandard/standard/ranges.md). Ranges using implicit range support return the same sequence type as the source sequence. For example, the following .NET types support both indices and ranges: , , and . The supports indices but doesn't support ranges. diff --git a/docs/standard/attributes/writing-custom-attributes.md b/docs/standard/attributes/writing-custom-attributes.md index d0d1545b77e04..264110d9931ad 100644 --- a/docs/standard/attributes/writing-custom-attributes.md +++ b/docs/standard/attributes/writing-custom-attributes.md @@ -143,4 +143,4 @@ To design custom attributes, you don't need to learn many new concepts. If you'r - - - [Attributes](index.md) -- [Attribute parameter types](~/_csharpstandard/standard/attributes.md#2224-attribute-parameter-types) +- [Attribute parameter types](~/_csharpstandard/standard/attributes.md#2324-attribute-parameter-types) diff --git a/docs/visual-basic/misc/bc33003.md b/docs/visual-basic/misc/bc33003.md index f5264583b628d..db297fd4a8b41 100644 --- a/docs/visual-basic/misc/bc33003.md +++ b/docs/visual-basic/misc/bc33003.md @@ -13,7 +13,7 @@ ms.assetid: 8336402c-9393-4e8e-834d-55c2268f24f6 An [Operator Statement](../language-reference/statements/operator-statement.md) specifies the [Handles](../language-reference/statements/handles-clause.md) keyword. - Only a `Sub` procedure can handle events. An `Operator` procedure cannot. For more information on event handlers, see [How to: Call an Event Handler in Visual Basic](../programming-guide/language-features/procedures/how-to-call-an-event-handler.md). + Only a `Sub` procedure can handle events. An `Operator` procedure cannot. For more information on event handlers, see [How to: Subscribe to Events and Handle Them in Visual Basic](../programming-guide/language-features/procedures/how-to-call-an-event-handler.md). An `Operator` procedure requires both the `Public` and `Shared` keywords, and a conversion operator requires either the `Widening` or the `Narrowing` keyword. For more information, see [Operator Procedures](../programming-guide/language-features/procedures/operator-procedures.md). diff --git a/docs/visual-basic/programming-guide/language-features/procedures/how-to-call-a-procedure-that-does-not-return-a-value.md b/docs/visual-basic/programming-guide/language-features/procedures/how-to-call-a-procedure-that-does-not-return-a-value.md index fe9775993c0ea..e23de4b4314d4 100644 --- a/docs/visual-basic/programming-guide/language-features/procedures/how-to-call-a-procedure-that-does-not-return-a-value.md +++ b/docs/visual-basic/programming-guide/language-features/procedures/how-to-call-a-procedure-that-does-not-return-a-value.md @@ -34,4 +34,4 @@ A `Sub` procedure does not return a value to the calling code. You call it expli - [Sub Statement](../../../language-reference/statements/sub-statement.md) - [How to: Create a Procedure](./how-to-create-a-procedure.md) - [How to: Call a Procedure That Returns a Value](./how-to-call-a-procedure-that-returns-a-value.md) -- [How to: Call an Event Handler in Visual Basic](./how-to-call-an-event-handler.md) +- [How to: Subscribe to Events and Handle Them in Visual Basic](./how-to-call-an-event-handler.md) diff --git a/docs/visual-basic/programming-guide/language-features/procedures/how-to-call-an-event-handler.md b/docs/visual-basic/programming-guide/language-features/procedures/how-to-call-an-event-handler.md index c3ee03c3860ea..4a3e9e1e11f3a 100644 --- a/docs/visual-basic/programming-guide/language-features/procedures/how-to-call-an-event-handler.md +++ b/docs/visual-basic/programming-guide/language-features/procedures/how-to-call-an-event-handler.md @@ -1,27 +1,34 @@ --- -description: "Learn more about: How to call an event handler in Visual Basic" -title: How to call an event handler +description: "Learn more about: How to subscribe to events and handle them in Visual Basic" +title: How to subscribe to events and handle them ms.date: 07/20/2015 helpviewer_keywords: - "Visual Basic code, procedures" - - "event handlers [Visual Basic], calling" + - "event handlers [Visual Basic], subscribing" - "event handlers" - "procedures [Visual Basic], event handlers" - - "procedures [Visual Basic], calling" + - "events [Visual Basic], subscribing" no-loc: [WithEvents] ms.assetid: 72e18ef8-144e-40df-a1f4-066a57271e28 --- -# How to call an event handler in Visual Basic +# How to subscribe to events and handle them in Visual Basic An *event* is an action or occurrence — such as a mouse click or a credit limit exceeded — that is recognized by some program component, and for which you can write code to respond. An *event handler* is the code you write to respond to an event. -An event handler in Visual Basic is a `Sub` procedure. However, you do not normally call it the same way as other `Sub` procedures. Instead, you identify the procedure as a handler for the event. You can do this either with a [`Handles`](../../../language-reference/statements/handles-clause.md) clause and a [`WithEvents`](../../../language-reference/modifiers/withevents.md) variable, or with an [AddHandler Statement](../../../language-reference/statements/addhandler-statement.md). Using a `Handles` clause is the default way to declare an event handler in Visual Basic. This is the way the event handlers are written by the designers when you program in the integrated development environment (IDE). The `AddHandler` statement is suitable for raising events dynamically at run time. +In Visual Basic, there are two sides to working with events: + +- **Event publishing** — Classes declare events and raise them when something interesting happens using the [RaiseEvent Statement](../../../language-reference/statements/raiseevent-statement.md). This is what actually invokes (calls) the event handlers. +- **Event subscription** — You subscribe to events by identifying procedures as handlers for specific events. You can do this either with a [`Handles`](../../../language-reference/statements/handles-clause.md) clause and a [`WithEvents`](../../../language-reference/modifiers/withevents.md) variable, or with an [AddHandler Statement](../../../language-reference/statements/addhandler-statement.md). + +An event handler in Visual Basic is a `Sub` procedure. Your code doesn't call it directly like other `Sub` procedures. Instead, event publishers invoke the procedure when the event is raised because the procedure is subscribed to the event. + +Using a `Handles` clause is the default way to subscribe to events in Visual Basic. This is how event handlers are written by the designers when you program in the integrated development environment (IDE). The `AddHandler` statement is suitable for subscribing to events dynamically at run time. When the event occurs, Visual Basic automatically calls the event handler procedure. Any code that has access to the event can cause it to occur by executing a [RaiseEvent Statement](../../../language-reference/statements/raiseevent-statement.md). You can associate more than one event handler with the same event. In some cases you can dissociate a handler from an event. For more information, see [Events](../events/index.md). -## Call an event handler using :::no-loc text="Handles"::: and WithEvents +## Subscribe to an event using :::no-loc text="Handles"::: and WithEvents 1. Make sure the event is declared with an [Event Statement](../../../language-reference/statements/event-statement.md). @@ -29,19 +36,19 @@ You can associate more than one event handler with the same event. In some cases 3. In the declaration of the event-handling `Sub` procedure, add a [`Handles`](../../../language-reference/statements/handles-clause.md) clause that specifies the `WithEvents` variable and the event name. -4. When the event occurs, Visual Basic automatically calls the `Sub` procedure. Your code can use a `RaiseEvent` statement to make the event occur. +4. When the event occurs, Visual Basic automatically calls the `Sub` procedure. Your code can use a `RaiseEvent` statement to raise the event and invoke all subscribed handlers. The following example defines an event and a `WithEvents` variable that refers to the class that raises the event. The event-handling `Sub` procedure uses a `Handles` clause to specify the class and event it handles. :::code language="vb" source="snippets/how-to-call-an-event-handler/SpecialForm.vb" id="4"::: -## Call an event handler using AddHandler +## Subscribe to an event using AddHandler 1. Make sure the event is declared with an `Event` statement. 2. Execute an [AddHandler statement](../../../language-reference/statements/addhandler-statement.md) to dynamically connect the event-handling `Sub` procedure with the event. -3. When the event occurs, Visual Basic automatically calls the `Sub` procedure. Your code can use a `RaiseEvent` statement to make the event occur. +3. When the event occurs, Visual Basic automatically calls the `Sub` procedure. Your code can use a `RaiseEvent` statement to raise the event and invoke all subscribed handlers. The following example uses the [AddHandler statement](../../../language-reference/statements/addhandler-statement.md) in the constructor to associate the `OnTimerElapsed` procedure as an event handler for a custom timer event. diff --git a/docs/visual-basic/programming-guide/language-features/procedures/sub-procedures.md b/docs/visual-basic/programming-guide/language-features/procedures/sub-procedures.md index 4d0f0765ddb8a..d42e0c2cf3c75 100644 --- a/docs/visual-basic/programming-guide/language-features/procedures/sub-procedures.md +++ b/docs/visual-basic/programming-guide/language-features/procedures/sub-procedures.md @@ -90,4 +90,4 @@ The following example shows a typical call to `tellOperator`. - [Procedure Parameters and Arguments](./procedure-parameters-and-arguments.md) - [Sub Statement](../../../language-reference/statements/sub-statement.md) - [How to: Call a Procedure that Does Not Return a Value](./how-to-call-a-procedure-that-does-not-return-a-value.md) -- [How to: Call an Event Handler in Visual Basic](./how-to-call-an-event-handler.md) +- [How to: Subscribe to Events and Handle Them in Visual Basic](./how-to-call-an-event-handler.md) diff --git a/docs/visual-basic/programming-guide/language-features/procedures/toc.yml b/docs/visual-basic/programming-guide/language-features/procedures/toc.yml index fa05a91b1c43b..e7a08fdc89f09 100644 --- a/docs/visual-basic/programming-guide/language-features/procedures/toc.yml +++ b/docs/visual-basic/programming-guide/language-features/procedures/toc.yml @@ -8,7 +8,7 @@ items: - name: "How to: Call a Procedure that Does Not Return a Value" href: how-to-call-a-procedure-that-does-not-return-a-value.md - - name: "How to: Call an Event Handler" + - name: "How to: Subscribe to Events and Handle Them" href: how-to-call-an-event-handler.md - name: Function Procedures href: function-procedures.md