dotnet / dotnet/dotnet-api-docs

bad example

Open
#973 0 comments 0 reactions 0 assignees View on GitHub
area-System.Collections dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

string value = ""; //may give impression that it will stay "" if "tif" key is not found
if (openWith.TryGetValue("tif", out value)) // but value will become null

---
#### Document Details

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

* ID: 41dfd07d-9111-765b-0900-a76b768e176a
* Version Independent ID: 9302710e-bb44-7a89-4ba5-217a1f987115
* Content: [Dictionary<TKey,TValue>.TryGetValue(TKey, TValue) Method (System.Collections.Generic)](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2.trygetvalue?view=netframework-4.7.2)
* Content Source: [xml/System.Collections.Generic/Dictionary`2.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Collections.Generic/Dictionary`2.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Research direction

Open xml/System.Collections.Generic/Dictionary`2.xml and locate the TryGetValue(TKey, TValue) example linked in the issue. Review the sample around the shown initialization and missing-key case, then adjust the documentation so its behavior is not misleading. Confirm the rendered API example accurately reflects the method's out-value behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.