dotnet / dotnet/dotnet-api-docs
System.Linq.Enumerable TakeLast and SkipLast don't have XML docs
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
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](https://github.com/dotnet/samples/blob/master/snippets/csharp/VS_Snippets_CLR_System/system.Linq.Enumerable/CS/enumerable.cs). Apparently the .csproj has `netcoreapp2.2;net472`, and neither methods are available under the `net472` target:

After a little searching I've found this comment by @karelz https://github.com/dotnet/corefx/pull/14186#issuecomment-438356738 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](https://devblogs.microsoft.com/dotnet/announcing-net-core-3-preview-3/) - 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.
```csharp
#region SkipLast
static void SkipLast()
{
//
#if NETCOREAPP
int[] grades = { 59, 82, 70, 56, 92, 98, 85 };
IEnumerable 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
*/
//
}
#endregion
#region TakeLast
static void TakeLast()
{
//
#if NETCOREAPP
int[] grades = { 59, 82, 70, 56, 92, 98, 85 };
IEnumerable 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
*/
//
}
#endregion
```
Contributor guide
Assessment
This issue has not been assessed yet.