You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: xml/System.Collections.Generic/Dictionary`2.xml
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -292,8 +292,8 @@
292
292
## Examples
293
293
The following code example shows how to use the <xref:System.Collections.Generic.Dictionary%602.%23ctor%28System.Collections.Generic.IEqualityComparer%7B%600%7D%29> constructor to initialize a <xref:System.Collections.Generic.Dictionary%602> with sorted content from another dictionary. The code example creates a <xref:System.Collections.Generic.SortedDictionary%602> and populates it with data in random order, then passes the <xref:System.Collections.Generic.SortedDictionary%602> to the <xref:System.Collections.Generic.Dictionary%602.%23ctor%28System.Collections.Generic.IEqualityComparer%7B%600%7D%29> constructor, creating a <xref:System.Collections.Generic.Dictionary%602> that is sorted. This is useful if you need to build a sorted dictionary that at some point becomes static; copying the data from a <xref:System.Collections.Generic.SortedDictionary%602> to a <xref:System.Collections.Generic.Dictionary%602> improves retrieval speed.
The following code example creates a <xref:System.Collections.Generic.Dictionary%602> with a case-insensitive equality comparer for the current culture. The example adds four elements, some with lower-case keys and some with upper-case keys. The example then attempts to add an element with a key that differs from an existing key only by case, catches the resulting exception, and displays an error message. Finally, the example displays the elements in the dictionary.
> When you create a new dictionary with a case-insensitive comparer and populate it with entries from a dictionary that uses a case-sensitive comparer, as in this example, an exception occurs if the input dictionary has keys that differ only by case.
The following code example creates a <xref:System.Collections.Generic.Dictionary%602> with an initial capacity of 5 and a case-insensitive equality comparer for the current culture. The example adds four elements, some with lower-case keys and some with upper-case keys. The example then attempts to add an element with a key that differs from an existing key only by case, catches the resulting exception, and displays an error message. Finally, the example displays the elements in the dictionary.
Copy file name to clipboardExpand all lines: xml/System.Collections.Generic/List`1.xml
+14-29Lines changed: 14 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -2967,6 +2967,18 @@ Public Function StartsWith(e As Employee) As Boolean
2967
2967
</AssemblyInfo>
2968
2968
<Docs>
2969
2969
<summary>Returns the zero-based index of the last occurrence of a value in the <seecref="T:System.Collections.Generic.List`1" /> or in a portion of it.</summary>
2970
+
<remarks>
2971
+
<formattype="text/markdown"><![CDATA[
2972
+
2973
+
## Examples
2974
+
The following example demonstrates all three overloads of the <xref:System.Collections.Generic.List%601.LastIndexOf%2A> method. A <xref:System.Collections.Generic.List%601> of strings is created, with one entry that appears twice, at index location 0 and index location 5. The <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%29> method overload searches the entire list from the end, and finds the second occurrence of the string. The <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%2CSystem.Int32%29> method overload is used to search the list backward beginning with index location 3 and continuing to the beginning of the list, so it finds the first occurrence of the string in the list. Finally, the <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%2CSystem.Int32%2CSystem.Int32%29> method overload is used to search a range of four entries, beginning at index location 4 and extending backward (that is, it searches the items at locations 4, 3, 2, and 1); this search returns -1 because there are no instances of the search string in that range.
@@ -3017,15 +3029,6 @@ Public Function StartsWith(e As Employee) As Boolean
3017
3029
3018
3030
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is <xref:System.Collections.Generic.List%601.Count%2A>.
3019
3031
3020
-
3021
-
3022
-
## Examples
3023
-
The following example demonstrates all three overloads of the <xref:System.Collections.Generic.List%601.LastIndexOf%2A> method. A <xref:System.Collections.Generic.List%601> of strings is created, with one entry that appears twice, at index location 0 and index location 5. The <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%29> method overload searches the entire list from the end, and finds the second occurrence of the string. The <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%2CSystem.Int32%29> method overload is used to search the list backward beginning with index location 3 and continuing to the beginning of the list, so it finds the first occurrence of the string in the list. Finally, the <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%2CSystem.Int32%2CSystem.Int32%29> method overload is used to search a range of four entries, beginning at index location 4 and extending backward (that is, it searches the items at locations 4, 3, 2, and 1); this search returns -1 because there are no instances of the search string in that range.
@@ -3082,16 +3085,7 @@ Public Function StartsWith(e As Employee) As Boolean
3082
3085
This method determines equality using the default equality comparer <xref:System.Collections.Generic.EqualityComparer%601.Default%2A?displayProperty=nameWithType> for `T`, the type of values in the list.
3083
3086
3084
3087
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is the number of elements from the beginning of the <xref:System.Collections.Generic.List%601> to `index`.
3085
-
3086
-
3087
-
3088
-
## Examples
3089
-
The following example demonstrates all three overloads of the <xref:System.Collections.Generic.List%601.LastIndexOf%2A> method. A <xref:System.Collections.Generic.List%601> of strings is created, with one entry that appears twice, at index location 0 and index location 5. The <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%29> method overload searches the entire list from the end, and finds the second occurrence of the string. The <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%2CSystem.Int32%29> method overload is used to search the list backward beginning with index location 3 and continuing to the beginning of the list, so it finds the first occurrence of the string in the list. Finally, the <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%2CSystem.Int32%2CSystem.Int32%29> method overload is used to search a range of four entries, beginning at index location 4 and extending backward (that is, it searches the items at locations 4, 3, 2, and 1); this search returns -1 because there are no instances of the search string in that range.
@@ -3152,16 +3146,7 @@ Public Function StartsWith(e As Employee) As Boolean
3152
3146
This method determines equality using the default equality comparer <xref:System.Collections.Generic.EqualityComparer%601.Default%2A?displayProperty=nameWithType> for `T`, the type of values in the list.
3153
3147
3154
3148
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is `count`.
3155
-
3156
-
3157
-
3158
-
## Examples
3159
-
The following example demonstrates all three overloads of the <xref:System.Collections.Generic.List%601.LastIndexOf%2A> method. A <xref:System.Collections.Generic.List%601> of strings is created, with one entry that appears twice, at index location 0 and index location 5. The <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%29> method overload searches the entire list from the end, and finds the second occurrence of the string. The <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%2CSystem.Int32%29> method overload is used to search the list backward beginning with index location 3 and continuing to the beginning of the list, so it finds the first occurrence of the string in the list. Finally, the <xref:System.Collections.Generic.List%601.LastIndexOf%28%600%2CSystem.Int32%2CSystem.Int32%29> method overload is used to search a range of 4 entries, beginning at index location 4 and extending backward (that is, it searches the items at locations 4, 3, 2, and 1); this search returns -1 because there are no instances of the search string in that range.
0 commit comments