I think it would be nice to have a section in this doc saying "this feature was introduced in version X of the language". Could be extended for deprecated features, etc.
This is useful for those of us that are still on legacy systems and have to be careful about what we use and where.
Instead, now I have to look somewhere else for this information.
Thanks for reading folks :)
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for writing this @TheBeardedLlama
I agree that this is useful information to add. I'm thinking about how best to present it, and how to clearly distinguish versions for different features. It's complicated because of the interaction between different features.
My pleasure @BillWagner
This type of available in version thingamabob is quite heavily used in SQL server and TFS docs.
Something similar to that would work I think.
I'm not sure what you mean about interaction? There's a table in one of the repos (sorry can't remember the URL) that lists what feature was made available at which version of C#. Wouldn't that be all that's required?
I agree. I think it should be updated to reflect the version numbers for which this is available.
@TheBeardedLlama
There's a table in one of the repos (sorry can't remember the URL) that lists what feature was made available at which version of C#.
Do you mean this table?
If so, that's a good solution.
My concern about interplay of different features is when there are subtle changes to existing features. Here are a couple examples:
switch statement has been around since version 1. It was enhanced in C# 7 with pattern matching.is statement has the same concerns. Prior to C# 7, is was invalid on value types. Not after C# 7.ref locals were added in 7.0. They can be reassigned, and used in ? : expressions in 7.2.In all those cases, it becomes much harder to explain a feature across versions, and do it clearly.
We've taken the strategy of describing the current features, often including a parenthetical notes about when a new(ish) feature was added.
I'll propose the following as a fix for this issue:
Vote this up if you like the plan, or add other suggestions.
That would be one of the tables yes. I think there's another one, but that's not important.
In the case of features evolving across versions, my recommendation would be to adopt TFS/VSTS docs conventions and have a tabbed section (or something to that effect) with what the feature looked like in a particular version.
I can't remember if SQL server docs do that as well. I think they do, but I'm not 100% sure.
Your proposal would work for this page, but I'm not sure how you'd like to handle the wider docs issue.
Should I raise a separate issue? Something else?
@dend Would the conceptual versioning support these scenarios? If so, I'll add to the backlog until that capability is available.
Technically (when applied to the referenced article), this issue is fixed by #12240. A new text mentions the language version:
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/member-access-operators#null-conditional-operators--and-
In general, I've noticed a trend to mention the language version, in which the feature is introduced, if that version is C# 6 or later. So, I would say if the language version is not mentioned, that would mean C# 5 or earlier. Is that an acceptable solution to make sure that language versions are mentioned only for the features added in C# 6 or later?
Duplicate of this issue is #12151
Most helpful comment
Thanks for writing this @TheBeardedLlama
I agree that this is useful information to add. I'm thinking about how best to present it, and how to clearly distinguish versions for different features. It's complicated because of the interaction between different features.