Description
Hi dotnet-api-docs team.
As the title says System.Linq.Enumerable TakeLast and SkipLast don't have XML docs. Technically I'm opening a third issue on this after #1060 and #1061 but those two aren't really clear on the issue and as I dived in to do a PR I realized it's a tad more complex than just filling out the missing parts in this repo.
The complication dawned on me when I wanted to create the snippet samples first for the two extension methods here. Apparently the .csproj has <TargetFrameworks>netcoreapp2.2;net472</TargetFrameworks>
, and neither methods are available under the net472
target:
After a little searching I've found this comment by @karelz dotnet/corefx#14186 (comment) which sheds some light on why weren't the docs added on release.
Some time has passed now, the shipping date is being announced in a month - my question is: is there a guideline for doing docs/samples for these kinds of APIs now?
If I wrap the samples in #if NETCOREAPP
conditionals that solves the build issue, but I'd definitely add some sort of warning in there as well for those who'd just blindly copy the sample.
#region SkipLast
static void SkipLast()
{
// <Snippet203>
#if NETCOREAPP
int[] grades = { 59, 82, 70, 56, 92, 98, 85 };
IEnumerable<int> topGrades =
grades.OrderByDescending(g => g).SkipLast(3);
Console.WriteLine("All grades except the bottom three are:");
foreach (int grade in topGrades)
{
Console.WriteLine(grade);
}
#endif
/*
This code produces the following output:
All grades except the bottom three are:
98
92
85
82
*/
// </Snippet203>
}
#endregion
#region TakeLast
static void TakeLast()
{
// <Snippet204>
#if NETCOREAPP
int[] grades = { 59, 82, 70, 56, 92, 98, 85 };
IEnumerable<int> bottomThreeGrades =
grades.OrderByDescending(grade => grade).TakeLast(3);
Console.WriteLine("The bottom three grades are:");
foreach (int grade in bottomThreeGrades)
{
Console.WriteLine(grade);
}
#endif
/*
This code produces the following output:
The bottom three grades are:
70
59
56
*/
// </Snippet204>
}
#endregion