Skip to content

Commit 5930fb6

Browse files
SeanKilleenmairaw
authored andcommitted
Add missing documentation for TryAdd API (dotnet#2260)
* Add missing documentation for TryAdd API * fix typo * use lang keywords for true/false * use ref for Add method * refer to method directly since we're in the doc for it * capitalization * more formal language * change to cref format based on build feedback * Update xml/System.Collections.Generic/Dictionary`2.xml Co-Authored-By: SeanKilleen <SeanKilleen@gmail.com> * Update xml/System.Collections.Generic/Dictionary`2.xml Co-Authored-By: SeanKilleen <SeanKilleen@gmail.com> * Update xml/System.Collections.Generic/Dictionary`2.xml Co-Authored-By: SeanKilleen <SeanKilleen@gmail.com> * Apply suggestions from code review Co-Authored-By: SeanKilleen <SeanKilleen@gmail.com> * Update xml/System.Collections.Generic/Dictionary`2.xml Co-Authored-By: SeanKilleen <SeanKilleen@gmail.com> * fixing link
1 parent 53a980a commit 5930fb6

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

xml/System.Collections.Generic/Dictionary`2.xml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,11 +2778,21 @@ finally {
27782778
<Parameter Name="value" Type="TValue" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netstandard-2.1" />
27792779
</Parameters>
27802780
<Docs>
2781-
<param name="key">To be added.</param>
2782-
<param name="value">To be added.</param>
2783-
<summary>To be added.</summary>
2784-
<returns>To be added.</returns>
2785-
<remarks>To be added.</remarks>
2781+
<param name="key">The key of the element to add.</param>
2782+
<param name="value">The value of the element to add. It can be <see langword="null" />.</param>
2783+
<summary>Attempts to add the specified key and value to the dictionary.</summary>
2784+
<returns><see langword="true" /> if the key/value pair was added to the dictionary successfully; otherwise, <see langword="false" />.</returns>
2785+
<remarks>
2786+
<format type="text/markdown"><![CDATA[
2787+
2788+
## Remarks
2789+
2790+
Unlike the <xref:System.Collections.Generic.Dictionary%602.Add%2A> method, this method doesn't throw an exception if the element with the given key exists in the dictionary. Unlike the Dictionary indexer, `TryAdd` doesn't override the element if the element with the given key exists in the dictionary. If the key already exists, `TryAdd` does nothing and returns `false`.
2791+
2792+
]]></format>
2793+
</remarks>
2794+
<exception cref="T:System.ArgumentNullException">
2795+
<paramref name="key" /> is <see langword="null" />.</exception>
27862796
</Docs>
27872797
</Member>
27882798
<Member MemberName="TryGetValue">
@@ -2925,4 +2935,4 @@ finally {
29252935
</Docs>
29262936
</Member>
29272937
</Members>
2928-
</Type>
2938+
</Type>

0 commit comments

Comments
 (0)