Skip to content

Commit 944505c

Browse files
authored
.NET Interactive: Enable_try_dotnet_to_batch_10b (#4343)
* enable_try_dotnet_to_batch_10b * update_remarks_line * changed_to_new_syntax
1 parent e25a1b4 commit 944505c

File tree

9 files changed

+107
-145
lines changed

9 files changed

+107
-145
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@
292292
## Examples
293293
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.
294294
295-
[!code-csharp[Generic.Dictionary.ctor_IDic#1](~/samples/snippets/csharp/VS_Snippets_CLR/Generic.Dictionary.ctor_IDic/CS/source.cs#1)]
296-
[!code-vb[Generic.Dictionary.ctor_IDic#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary.ctor_IDic/VB/source.vb#1)]
295+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Generic.Dictionary.ctor_IDic/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
296+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary.ctor_IDic/VB/source.vb" id="Snippet1":::
297297
298298
]]></format>
299299
</remarks>
@@ -395,8 +395,8 @@
395395
## Examples
396396
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.
397397
398-
[!code-csharp[Generic.Dictionary.ctor_IEqC#1](~/samples/snippets/csharp/VS_Snippets_CLR/Generic.Dictionary.ctor_IEqC/CS/source.cs#1)]
399-
[!code-vb[Generic.Dictionary.ctor_IEqC#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary.ctor_IEqC/VB/source.vb#1)]
398+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Generic.Dictionary.ctor_IEqC/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
399+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary.ctor_IEqC/VB/source.vb" id="Snippet1":::
400400
401401
]]></format>
402402
</remarks>
@@ -458,8 +458,8 @@
458458
## Examples
459459
The following code example creates a dictionary with an initial capacity of 4 and populates it with 4 entries.
460460
461-
[!code-csharp[Generic.Dictionary.ctor_Int32#1](~/samples/snippets/csharp/VS_Snippets_CLR/Generic.Dictionary.ctor_Int32/CS/source.cs#1)]
462-
[!code-vb[Generic.Dictionary.ctor_Int32#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary.ctor_Int32/VB/source.vb#1)]
461+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Generic.Dictionary.ctor_Int32/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
462+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary.ctor_Int32/VB/source.vb" id="Snippet1":::
463463
464464
]]></format>
465465
</remarks>
@@ -530,8 +530,8 @@
530530
> [!NOTE]
531531
> 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.
532532
533-
[!code-csharp[Generic.Dictionary.ctor_IDicIEqC#1](~/samples/snippets/csharp/VS_Snippets_CLR/Generic.Dictionary.ctor_IDicIEqC/CS/source.cs#1)]
534-
[!code-vb[Generic.Dictionary.ctor_IDicIEqC#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary.ctor_IDicIEqC/VB/source.vb#1)]
533+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Generic.Dictionary.ctor_IDicIEqC/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
534+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary.ctor_IDicIEqC/VB/source.vb" id="Snippet1":::
535535
536536
]]></format>
537537
</remarks>
@@ -639,8 +639,8 @@
639639
## Examples
640640
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.
641641
642-
[!code-csharp[Generic.Dictionary.ctor_Int32IEqC#1](~/samples/snippets/csharp/VS_Snippets_CLR/Generic.Dictionary.ctor_Int32IEqC/CS/source.cs#1)]
643-
[!code-vb[Generic.Dictionary.ctor_Int32IEqC#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary.ctor_Int32IEqC/VB/source.vb#1)]
642+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Generic.Dictionary.ctor_Int32IEqC/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
643+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary.ctor_Int32IEqC/VB/source.vb" id="Snippet1":::
644644
645645
]]></format>
646646
</remarks>

xml/System.Collections.Generic/List`1.xml

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2967,6 +2967,18 @@ Public Function StartsWith(e As Employee) As Boolean
29672967
</AssemblyInfo>
29682968
<Docs>
29692969
<summary>Returns the zero-based index of the last occurrence of a value in the <see cref="T:System.Collections.Generic.List`1" /> or in a portion of it.</summary>
2970+
<remarks>
2971+
<format type="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.
2975+
2976+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp" id="Snippet1":::
2977+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/List`1_LastIndexOf/cs/source.cs" interactive="try-dotnet" id="Snippet1":::
2978+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_LastIndexOf/vb/source.vb" id="Snippet1":::
2979+
2980+
]]></format>
2981+
</remarks>
29702982
</Docs>
29712983
</MemberGroup>
29722984
<Member MemberName="LastIndexOf">
@@ -3017,15 +3029,6 @@ Public Function StartsWith(e As Employee) As Boolean
30173029
30183030
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>.
30193031
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.
3024-
3025-
[!code-cpp[List\`1_LastIndexOf#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp#1)]
3026-
[!code-csharp[List\`1_LastIndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_LastIndexOf/cs/source.cs#1)]
3027-
[!code-vb[List\`1_LastIndexOf#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_LastIndexOf/vb/source.vb#1)]
3028-
30293032
]]></format>
30303033
</remarks>
30313034
<altmember cref="M:System.Collections.Generic.List`1.IndexOf(`0)" />
@@ -3082,16 +3085,7 @@ Public Function StartsWith(e As Employee) As Boolean
30823085
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.
30833086
30843087
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.
3090-
3091-
[!code-cpp[List\`1_LastIndexOf#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp#1)]
3092-
[!code-csharp[List\`1_LastIndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_LastIndexOf/cs/source.cs#1)]
3093-
[!code-vb[List\`1_LastIndexOf#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_LastIndexOf/vb/source.vb#1)]
3094-
3088+
30953089
]]></format>
30963090
</remarks>
30973091
<exception cref="T:System.ArgumentOutOfRangeException">
@@ -3152,16 +3146,7 @@ Public Function StartsWith(e As Employee) As Boolean
31523146
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.
31533147
31543148
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.
3160-
3161-
[!code-cpp[List\`1_LastIndexOf#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp#1)]
3162-
[!code-csharp[List\`1_LastIndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_LastIndexOf/cs/source.cs#1)]
3163-
[!code-vb[List\`1_LastIndexOf#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_LastIndexOf/vb/source.vb#1)]
3164-
3149+
31653150
]]></format>
31663151
</remarks>
31673152
<exception cref="T:System.ArgumentOutOfRangeException">

0 commit comments

Comments
 (0)