Consolidate F# optional parameters documentation #47580
Draft
+8
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The F# documentation for optional parameters was incomplete and fragmented across multiple files. The
methods.md
file only covered C# interop-style optional arguments using[<Optional; DefaultParameterValue>]
attributes, while missing the native F# optional parameter syntax using?
.This PR consolidates all optional parameter documentation into the
parameters-and-arguments.md
file with clear distinctions between the two forms:?
syntax for F#-idiomatic optional parameters that are interpreted as F# option types[<Optional; DefaultParameterValue>]
attributes for C# compatibility, introduced in F# 4.1The
methods.md
file now simply references the comprehensive documentation inparameters-and-arguments.md
, eliminating duplication and providing developers with a single authoritative source for all optional parameter information.This addresses the concern raised in the issue that the F# language's native optional parameter mechanism was not covered in the documentation, which was "very curious" given how commonly this technique is used.
Fixes #45813.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.