dotnet / dotnet/dotnet-api-docs

Clarify purpose of `BlockingCollection<T>.GetConsumingEnumerable` and relationship to `Take`

Offen
#779 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
.net/prod area-System.Collections Pri2 unspecified/svc untriaged
Vorherrschende Sprache
C#
Sterne
949
Forks
1.7k
Ø Merge
2 T. 19 Std.
Gemergte PRs (30 T.)
52

Beschreibung

I have two suggestions:
1. Add a "Remarks" section to `GetConsumingEnumerable()` that is identical to the remarks section for `GetConsumingEnumerable(CancellationToken)`. It contains several useful facts about how `GetConsumingEnumerable()` works. Putting it in the "Remarks" section for `GetConsumingEnumerable(CancellationToken)` isn't sufficient because people like me that don't care about cancellation are unlikely to look at `GetConsumingEnumerable(CancellationToken)`.
2. In the "Remarks" section for `Take`, mention that if you want to consume items in a loop, consider using `GetConsumingEnumerable` which is designed for this use case. I'm assuming that's the relationship between `Take` and `GetConsumingEnumerable`. It took some thinking on my part to infer this because it's not explicitly stated anywhere. You might also want to make a statement about `Take` in the "Remarks" section for `GetConsumingEnumerable`.

Adam Comella
Microsoft Corp.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: f8df56b2-d5da-8d38-ea9d-7f2fb50f877f
* Version Independent ID: f903165e-d4c7-939f-6679-413310730fe6
* Content: [BlockingCollection.GetConsumingEnumerable Method (System.Collections.Concurrent)](https://docs.microsoft.com/en-us/dotnet/api/system.collections.concurrent.blockingcollection-1.getconsumingenumerable?view=netframework-4.7.2#System_Collections_Concurrent_BlockingCollection_1_GetConsumingEnumerable)
* Content Source: [xml/System.Collections.Concurrent/BlockingCollection`1.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Collections.Concurrent/BlockingCollection`1.xml)
* Service: **unspecified**
* Product: **.net**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Öffne xml/System.Collections.Concurrent/BlockingCollection`1.xml und überprüfe die Remarks-Abschnitte für GetConsumingEnumerable(), GetConsumingEnumerable(CancellationToken) und Take. Füge die angeforderte Erklärung der parameterlosen Methode hinzu und stelle klar, wann GetConsumingEnumerable gegenüber Take in einer Schleife vorzuziehen ist. Als erledigt gilt die Aufgabe, wenn die zugehörige API-Dokumentation ihre Beziehung ausdrücklich erklärt, ohne auf die Überladungsvariante mit CancellationToken angewiesen zu sein.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
1/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.