Skip to content

Commit 9581c38

Browse files
Try. NET update for system.collections.generic.list-1.* (#2838)
* updating for try.net * replaced Note text with include file * added a space to re-trigger stuck build * updated all instances of that source ref * Thank you Maira for catching this Co-Authored-By: Maira Wenzel <[email protected]>
1 parent 30c78db commit 9581c38

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

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

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@
108108
109109
110110
## Examples
111+
112+
[!INCLUDE[interactive-note](~/includes/csharp-interactive-note-some.md)]
113+
111114
The following example demonstrates how to add, remove, and insert a simple business object in a <xref:System.Collections.Generic.List%601>.
112115
113116
[!code-csharp[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/cs/program.cs#1)]
@@ -127,7 +130,7 @@
127130
Finally, the <xref:System.Collections.Generic.List%601.Clear%2A> method is used to remove all items from the list, and the <xref:System.Collections.Generic.List%601.Capacity%2A> and <xref:System.Collections.Generic.List%601.Count%2A> properties are displayed.
128131
129132
[!code-cpp[List\`1_Class#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp#1)]
130-
[!code-csharp[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
133+
[!code-csharp-interactive[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
131134
[!code-vb[List\`1_Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#1)]
132135
[!code-fsharp[List\`1_Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs#1)]
133136
@@ -201,12 +204,15 @@
201204
202205
203206
## Examples
207+
208+
[!INCLUDE[interactive-note](~/includes/csharp-interactive-note-some.md)]
209+
204210
The following example demonstrates the parameterless constructor of the <xref:System.Collections.Generic.List%601> generic class. The parameterless constructor creates a list with the default capacity, as demonstrated by displaying the <xref:System.Collections.Generic.List%601.Capacity%2A> property.
205211
206212
The example adds, inserts, and removes items, showing how the capacity changes as these methods are used.
207213
208214
[!code-cpp[List\`1_Class#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp#1)]
209-
[!code-csharp[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
215+
[!code-csharp-interactive[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
210216
[!code-vb[List\`1_Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#1)]
211217
[!code-fsharp[List\`1_Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs#1)]
212218
@@ -387,6 +393,9 @@
387393
388394
389395
## Examples
396+
397+
[!INCLUDE[interactive-note](~/includes/csharp-interactive-note-some.md)]
398+
390399
The following example demonstrates how to add, remove, and insert a simple business object in a <xref:System.Collections.Generic.List%601>.
391400
392401
[!code-csharp[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/cs/program.cs#1)]
@@ -398,7 +407,7 @@
398407
Other properties and methods are used to search for, insert, and remove elements from the list, and finally to clear the list.
399408
400409
[!code-cpp[List\`1_Class#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp#1)]
401-
[!code-csharp[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
410+
[!code-csharp-interactive[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
402411
[!code-vb[List\`1_Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#1)]
403412
[!code-fsharp[List\`1_Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs#1)]
404413
@@ -840,8 +849,11 @@
840849
Retrieving the value of this property is an O(1) operation; setting the property is an O(*n*) operation, where *n* is the new capacity.
841850
842851
843-
852+
844853
## Examples
854+
855+
[!INCLUDE[interactive-note](~/includes/csharp-interactive-note-some.md)]
856+
845857
The following example demonstrates how to check the capacity and count of a <xref:System.Collections.Generic.List%601> that contains a simple business object, and illustrates using the <xref:System.Collections.Generic.List%601.TrimExcess%2A> method to remove extra capacity.
846858
847859
[!code-csharp[System.Collections.Generic.List.CapacityCount#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.capacitycount/cs/program.cs#1)]
@@ -852,7 +864,7 @@
852864
The <xref:System.Collections.Generic.List%601.Capacity%2A> property is displayed again after the <xref:System.Collections.Generic.List%601.TrimExcess%2A> method is used to reduce the capacity to match the count. Finally, the <xref:System.Collections.Generic.List%601.Clear%2A> method is used to remove all items from the list, and the <xref:System.Collections.Generic.List%601.Capacity%2A> and <xref:System.Collections.Generic.List%601.Count%2A> properties are displayed again.
853865
854866
[!code-cpp[List\`1_Class#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp#1)]
855-
[!code-csharp[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
867+
[!code-csharp-interactive[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
856868
[!code-vb[List\`1_Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#1)]
857869
[!code-fsharp[List\`1_Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs#1)]
858870
@@ -913,10 +925,13 @@
913925
914926
915927
## Examples
928+
929+
[!INCLUDE[interactive-note](~/includes/csharp-interactive-note.md)]
930+
916931
The following example demonstrates the <xref:System.Collections.Generic.List%601.Clear%2A> method and various other properties and methods of the <xref:System.Collections.Generic.List%601> generic class. The <xref:System.Collections.Generic.List%601.Clear%2A> method is used at the end of the program, to remove all items from the list, and the <xref:System.Collections.Generic.List%601.Capacity%2A> and <xref:System.Collections.Generic.List%601.Count%2A> properties are then displayed.
917932
918933
[!code-cpp[List\`1_Class#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp#1)]
919-
[!code-csharp[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
934+
[!code-csharp-interactive[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
920935
[!code-vb[List\`1_Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#1)]
921936
[!code-fsharp[List\`1_Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs#1)]
922937
@@ -1335,6 +1350,9 @@
13351350
13361351
13371352
## Examples
1353+
1354+
[!INCLUDE[interactive-note](~/includes/csharp-interactive-note-some.md)]
1355+
13381356
The following example demonstrates how to check the capacity and count of a <xref:System.Collections.Generic.List%601> that contains a simple business object, and illustrates using the <xref:System.Collections.Generic.List%601.TrimExcess%2A> method to remove extra capacity.
13391357
13401358
[!code-csharp[System.Collections.Generic.List.CapacityCount#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.capacitycount/cs/program.cs#1)]
@@ -1343,7 +1361,7 @@
13431361
The following example shows the value of the <xref:System.Collections.Generic.List%601.Count%2A> property at various points in the life of a list. After the list has been created and populated and its elements displayed, the <xref:System.Collections.Generic.List%601.Capacity%2A> and <xref:System.Collections.Generic.List%601.Count%2A> properties are displayed. These properties are displayed again after the <xref:System.Collections.Generic.List%601.TrimExcess%2A> method has been called, and again after the contents of the list are cleared.
13441362
13451363
[!code-cpp[List\`1_Class#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp#1)]
1346-
[!code-csharp[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
1364+
[!code-csharp-interactive[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
13471365
[!code-vb[List\`1_Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#1)]
13481366
[!code-fsharp[List\`1_Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs#1)]
13491367
@@ -2707,6 +2725,9 @@ Public Function StartsWith(e As Employee) As Boolean
27072725
27082726
27092727
## Examples
2728+
2729+
[!INCLUDE[interactive-note](~/includes/csharp-interactive-note-some.md)]
2730+
27102731
The following example demonstrates how to add, remove, and insert a simple business object in a <xref:System.Collections.Generic.List%601>.
27112732
27122733
[!code-csharp[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/cs/program.cs#1)]
@@ -2716,7 +2737,7 @@ Public Function StartsWith(e As Employee) As Boolean
27162737
The following example demonstrates the <xref:System.Collections.Generic.List%601.Insert%2A> method, along with various other properties and methods of the <xref:System.Collections.Generic.List%601> generic class. After the list is created, elements are added. The <xref:System.Collections.Generic.List%601.Insert%2A> method is used to insert an item into the middle of the list. The item inserted is a duplicate, which is later removed using the <xref:System.Collections.Generic.List%601.Remove%2A> method.
27172738
27182739
[!code-cpp[List\`1_Class#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp#1)]
2719-
[!code-csharp[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
2740+
[!code-csharp-interactive[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
27202741
[!code-vb[List\`1_Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#1)]
27212742
[!code-fsharp[List\`1_Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs#1)]
27222743
@@ -3163,6 +3184,9 @@ Public Function StartsWith(e As Employee) As Boolean
31633184
31643185
31653186
## Examples
3187+
3188+
[!INCLUDE[interactive-note](~/includes/csharp-interactive-note-some.md)]
3189+
31663190
The following example demonstrates how to add, remove, and insert a simple business object in a <xref:System.Collections.Generic.List%601>.
31673191
31683192
[!code-csharp[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/cs/program.cs#1)]
@@ -3172,7 +3196,7 @@ Public Function StartsWith(e As Employee) As Boolean
31723196
The following example demonstrates <xref:System.Collections.Generic.List%601.Remove%2A> method. Several properties and methods of the <xref:System.Collections.Generic.List%601> generic class are used to add, insert, and search the list. After these operations, the list contains a duplicate. The <xref:System.Collections.Generic.List%601.Remove%2A> method is used to remove the first instance of the duplicate item, and the contents are displayed. The <xref:System.Collections.Generic.List%601.Remove%2A> method always removes the first instance it encounters.
31733197
31743198
[!code-cpp[List\`1_Class#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp#1)]
3175-
[!code-csharp[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
3199+
[!code-csharp-interactive[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
31763200
[!code-vb[List\`1_Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#1)]
31773201
[!code-fsharp[List\`1_Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs#1)]
31783202
@@ -4808,6 +4832,9 @@ finally
48084832
48094833
48104834
## Examples
4835+
4836+
[!INCLUDE[interactive-note](~/includes/csharp-interactive-note-some.md)]
4837+
48114838
The following example demonstrates how to check the capacity and count of a <xref:System.Collections.Generic.List%601> that contains a simple business object, and illustrates using the <xref:System.Collections.Generic.List%601.TrimExcess%2A> method to remove extra capacity.
48124839
48134840
[!code-csharp[System.Collections.Generic.List.CapacityCount#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.capacitycount/cs/program.cs#1)]
@@ -4816,7 +4843,7 @@ finally
48164843
The following example demonstrates the <xref:System.Collections.Generic.List%601.TrimExcess%2A> method. Several properties and methods of the <xref:System.Collections.Generic.List%601> class are used to add, insert, and remove items from a list of strings. Then the <xref:System.Collections.Generic.List%601.TrimExcess%2A> method is used to reduce the capacity to match the count, and the <xref:System.Collections.Generic.List%601.Capacity%2A> and <xref:System.Collections.Generic.List%601.Count%2A> properties are displayed. If the unused capacity had been less than 10 percent of total capacity, the list would not have been resized. Finally, the contents of the list are cleared.
48174844
48184845
[!code-cpp[List\`1_Class#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp#1)]
4819-
[!code-csharp[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
4846+
[!code-csharp-interactive[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)]
48204847
[!code-vb[List\`1_Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#1)]
48214848
[!code-fsharp[List\`1_Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs#1)]
48224849
@@ -4897,4 +4924,4 @@ finally
48974924
</Docs>
48984925
</Member>
48994926
</Members>
4900-
</Type>
4927+
</Type>

0 commit comments

Comments
 (0)