Skip to content

Specify the C# language version(s) for the when contextual keyword #45998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
astrohart opened this issue May 2, 2025 · 1 comment
Closed

Comments

@astrohart
Copy link

astrohart commented May 2, 2025

Type of issue

Missing information

Description

Describe the gap

The page for the when contextual keyword doesn’t mention which C# language versions support this feature.

Why it matters

Knowing the minimum language version helps developers decide whether they can use when in their target environment and avoid compiler‑version surprises.

Suggested fix

Add an “Introduced in” note—e.g., exception‑filter usage in C# 6.0 and pattern‑matching usage in C# 7.0.

Include a quick table or note under Version compatibility (similar to other keyword pages).

Thanks for keeping the docs ship‑shape!

Page URL

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/when#when-in-a-catch-clause

Content source URL

https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/keywords/when.md

Document Version Independent Id

15502bbc-5355-2add-0fa8-ae31dc01c122

Platform Id

fc890810-32dd-4d12-8d92-381651ec6eed

Article author

@BillWagner

Metadata

  • ID: 6ef10b29-fbf8-5af9-8f8b-a694a1416e33
  • PlatformId: fc890810-32dd-4d12-8d92-381651ec6eed
  • Service: dotnet-csharp
  • Sub-service: lang-reference

Related Issues

@BillWagner
Copy link
Member

Hi @astrohart

I did try an experiment with this some time ago. Adding version notes causes more issues than it fixes. In many articles, it requires multiple notes on which aspects of a features were introduced in which version. Example include pattern matching (is, switch expressions, and, or and not in patterns, list patterns, etc).

As a compromise, we've done two things with the C# docs:

  1. Any feature added in the last 3 GA versions is noted. Currently, that's anything added in C# 13, 12, and 11 (in addition to any preview features coming in C# 14).
  2. The C# version history article lists the features added in each version. That serves as the full roadmap. That article does list exception filters, which were added in C# 6 (almost 10 years ago).

For those reasons, I'll close this without action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants