- Notifications
You must be signed in to change notification settings - Fork1.6k
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 methodshere. Apparently the .csproj has<TargetFrameworks>netcoreapp2.2;net472</TargetFrameworks>
, and neither methods are available under thenet472
target:
After a little searching I've found this comment by@karelzdotnet/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 SkipLaststaticvoidSkipLast(){// <Snippet203> #ifNETCOREAPPint[]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(intgradeintopGrades){Console.WriteLine(grade);} #endif/* This code produces the following output: All grades except the bottom three are: 98 92 85 82 */// </Snippet203>} #endregion #region TakeLaststaticvoidTakeLast(){// <Snippet204> #ifNETCOREAPPint[]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(intgradeinbottomThreeGrades){Console.WriteLine(grade);} #endif/* This code produces the following output: The bottom three grades are: 70 59 56 */// </Snippet204>} #endregion