|
1460 | 1460 | ## Examples |
1461 | 1461 | The following example demonstrates the <xref:System.Collections.Generic.List%601.Contains%2A> and <xref:System.Collections.Generic.List%601.Exists%2A> methods on a <xref:System.Collections.Generic.List%601> that contains a simple business object that implements <xref:System.IEquatable%601.Equals%2A>. |
1462 | 1462 | |
1463 | | - [!code-csharp[System.Collections.Generic.List.ContainsExists#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/cs/program.cs#1)] |
1464 | | - [!code-vb[System.Collections.Generic.List.ContainsExists#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/vb/module1.vb#1)] |
| 1463 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/cs/program.cs" interactive="try-dotnet" id="Snippet1"::: |
| 1464 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/vb/module1.vb" id="Snippet1"::: |
1465 | 1465 | |
1466 | 1466 | The following example demonstrates the <xref:System.Collections.Generic.List%601.Exists%2A> method and several other methods that use the <xref:System.Predicate%601> generic delegate. |
1467 | 1467 | |
|
1473 | 1473 | |
1474 | 1474 | > [!NOTE] |
1475 | 1475 | > In C# and Visual Basic, it is not necessary to create the `Predicate<string>` delegate (`Predicate(Of String)` in Visual Basic) explicitly. These languages infer the correct delegate from context and create it automatically. |
1476 | | - |
1477 | | - [!code-cpp[List\`1_FindEtAl#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp#1)] |
1478 | | - [!code-csharp[List\`1_FindEtAl#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_FindEtAl/cs/source.cs#1)] |
1479 | | - [!code-vb[List\`1_FindEtAl#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb#1)] |
| 1476 | + |
| 1477 | + :::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp" id="Snippet1"::: |
| 1478 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/List`1_FindEtAl/cs/source.cs" interactive="try-dotnet" id="Snippet1"::: |
| 1479 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb" id="Snippet1"::: |
1480 | 1480 | |
1481 | 1481 | ]]></format> |
1482 | 1482 | </remarks> |
@@ -1746,8 +1746,8 @@ Public Function StartsWith(e As Employee) As Boolean |
1746 | 1746 | |
1747 | 1747 | corresponds to the signature of the delegate that can be passed to the <xref:System.Collections.Generic.List%601.FindIndex%2A> method. The example instantiates a `List<Employee>` object, adds a number of `Employee` objects to it, and then calls the <xref:System.Collections.Generic.List%601.FindIndex%28System.Int32%2CSystem.Int32%2CSystem.Predicate%7B%600%7D%29> method twice to search the entire collection, the first time for the first `Employee` object whose `Name` field begins with "J", and the second time for the first `Employee` object whose `Name` field begins with "Ju". |
1748 | 1748 | |
1749 | | - [!code-csharp[System.Collections.Generic.List.FindIndex#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/cs/FindIndex2.cs#2)] |
1750 | | - [!code-vb[System.Collections.Generic.List.FindIndex#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/vb/FindIndex2.vb#2)] |
| 1749 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/cs/FindIndex2.cs" interactive="try-dotnet" id="Snippet2"::: |
| 1750 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/vb/FindIndex2.vb" id="Snippet2"::: |
1751 | 1751 | |
1752 | 1752 | ]]></format> |
1753 | 1753 | </remarks> |
@@ -1836,9 +1836,9 @@ Public Function StartsWith(e As Employee) As Boolean |
1836 | 1836 | ``` |
1837 | 1837 | |
1838 | 1838 | corresponds to the signature of the delegate that can be passed to the <xref:System.Collections.Generic.List%601.FindIndex%2A> method. The example instantiates a `List<Employee>` object, adds a number of `Employee` objects to it, and then calls the <xref:System.Collections.Generic.List%601.FindIndex%28System.Int32%2CSystem.Int32%2CSystem.Predicate%7B%600%7D%29> method twice to search the collection starting with its fifth member (that is, the member at index 4). The first time, it searches for the first `Employee` object whose `Name` field begins with "J"; the second time, it searches for the first `Employee` object whose `Name` field begins with "Ju". |
1839 | | - |
1840 | | - [!code-csharp[System.Collections.Generic.List.FindIndex#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/cs/FindIndex3.cs#3)] |
1841 | | - [!code-vb[System.Collections.Generic.List.FindIndex#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/vb/FindIndex3.vb#3)] |
| 1839 | + |
| 1840 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/cs/FindIndex3.cs" interactive="try-dotnet" id="Snippet3"::: |
| 1841 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/vb/FindIndex3.vb" id="Snippet3"::: |
1842 | 1842 | |
1843 | 1843 | ]]></format> |
1844 | 1844 | </remarks> |
@@ -1932,8 +1932,8 @@ Public Function StartsWith(e As Employee) As Boolean |
1932 | 1932 | |
1933 | 1933 | corresponds to the signature of the delegate that can be passed to the <xref:System.Collections.Generic.List%601.FindIndex%2A> method. The example instantiates a `List<Employee>` object, adds a number of `Employee` objects to it, and then calls the <xref:System.Collections.Generic.List%601.FindIndex%28System.Int32%2CSystem.Int32%2CSystem.Predicate%7B%600%7D%29> method twice to search the entire collection (that is, the members from index 0 to index <xref:System.Collections.Generic.List%601.Count%2A> - 1). The first time, it searches for the first `Employee` object whose `Name` field begins with "J"; the second time, it searches for the first `Employee` object whose `Name` field begins with "Ju". |
1934 | 1934 | |
1935 | | - [!code-csharp[System.Collections.Generic.List.FindIndex#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/cs/FindIndex1.cs#1)] |
1936 | | - [!code-vb[System.Collections.Generic.List.FindIndex#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/vb/FindIndex1.vb#1)] |
| 1935 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/cs/FindIndex1.cs" interactive="try-dotnet" id="Snippet1"::: |
| 1936 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/vb/FindIndex1.vb" id="Snippet1"::: |
1937 | 1937 | |
1938 | 1938 | ]]></format> |
1939 | 1939 | </remarks> |
@@ -2356,8 +2356,8 @@ Public Function StartsWith(e As Employee) As Boolean |
2356 | 2356 | > [!NOTE] |
2357 | 2357 | > In addition to displaying the contents using the `Print` method, the C# example demonstrates the use of [anonymous methods](~/docs/csharp/programming-guide/statements-expressions-operators/anonymous-methods.md) to display the results to the console. |
2358 | 2358 | |
2359 | | - [!code-csharp[System.Action_PrintExample#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action_PrintExample/cs/action.cs#01)] |
2360 | | - [!code-vb[System.Action_PrintExample#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Action_PrintExample/vb/action.vb#01)] |
| 2359 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action_PrintExample/cs/action.cs" interactive="try-dotnet-method" id="Snippet01"::: |
| 2360 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Action_PrintExample/vb/action.vb" id="Snippet01"::: |
2361 | 2361 | |
2362 | 2362 | ]]></format> |
2363 | 2363 | </remarks> |
@@ -2492,10 +2492,10 @@ Public Function StartsWith(e As Employee) As Boolean |
2492 | 2492 | ## Examples |
2493 | 2493 | The following example demonstrates the <xref:System.Collections.Generic.List%601.GetRange%2A> method and other methods of the <xref:System.Collections.Generic.List%601> class that act on ranges. At the end of the example, the <xref:System.Collections.Generic.List%601.GetRange%2A> method is used to get three items from the list, beginning with index location 2. The <xref:System.Collections.Generic.List%601.ToArray%2A> method is called on the resulting <xref:System.Collections.Generic.List%601>, creating an array of three elements. The elements of the array are displayed. |
2494 | 2494 | |
2495 | | - [!code-cpp[List\`1_Ranges#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp#1)] |
2496 | | - [!code-csharp[List\`1_Ranges#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Ranges/cs/source.cs#1)] |
2497 | | - [!code-vb[List\`1_Ranges#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb#1)] |
2498 | | - |
| 2495 | + :::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1"::: |
| 2496 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Ranges/cs/source.cs" interactive="try-dotnet" id="Snippet1"::: |
| 2497 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1"::: |
| 2498 | +
|
2499 | 2499 | ]]></format> |
2500 | 2500 | </remarks> |
2501 | 2501 | <exception cref="T:System.ArgumentOutOfRangeException"> |
@@ -2800,16 +2800,16 @@ Public Function StartsWith(e As Employee) As Boolean |
2800 | 2800 |
|
2801 | 2801 | The following example demonstrates how to add, remove, and insert a simple business object in a <xref:System.Collections.Generic.List%601>. |
2802 | 2802 | |
2803 | | - [!code-csharp[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/cs/program.cs#1)] |
2804 | | - [!code-vb[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/vb/module1.vb#1)] |
2805 | | - [!code-fsharp[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/fs/addremoveinsert.fs#1)] |
| 2803 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/cs/program.cs" interactive="try-dotnet" id="Snippet1"::: |
| 2804 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/vb/module1.vb" id="Snippet1"::: |
| 2805 | + :::code language="fsharp" source="~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/fs/addremoveinsert.fs" id="Snippet1"::: |
2806 | 2806 | |
2807 | 2807 | 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. |
2808 | 2808 | |
2809 | | - [!code-cpp[List\`1_Class#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp#1)] |
2810 | | - [!code-csharp-interactive[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)] |
2811 | | - [!code-vb[List\`1_Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#1)] |
2812 | | - [!code-fsharp[List\`1_Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs#1)] |
| 2809 | + :::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1"::: |
| 2810 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs" interactive="try-dotnet-method" id="Snippet1"::: |
| 2811 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1"::: |
| 2812 | + :::code language="fsharp" source="~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1"::: |
2813 | 2813 | |
2814 | 2814 | ]]></format> |
2815 | 2815 | </remarks> |
@@ -2882,9 +2882,9 @@ Public Function StartsWith(e As Employee) As Boolean |
2882 | 2882 | ## Examples |
2883 | 2883 | The following example demonstrates <xref:System.Collections.Generic.List%601.InsertRange%2A> method and various other methods of the <xref:System.Collections.Generic.List%601> class that act on ranges. After the list has been created and populated with the names of several peaceful plant-eating dinosaurs, the <xref:System.Collections.Generic.List%601.InsertRange%2A> method is used to insert an array of three ferocious meat-eating dinosaurs into the list, beginning at index location 3. |
2884 | 2884 | |
2885 | | - [!code-cpp[List\`1_Ranges#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp#1)] |
2886 | | - [!code-csharp[List\`1_Ranges#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Ranges/cs/source.cs#1)] |
2887 | | - [!code-vb[List\`1_Ranges#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb#1)] |
| 2885 | + :::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1"::: |
| 2886 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Ranges/cs/source.cs" interactive="try-dotnet" id="Snippet1"::: |
| 2887 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1"::: |
2888 | 2888 | |
2889 | 2889 | ]]></format> |
2890 | 2890 | </remarks> |
@@ -2971,10 +2971,10 @@ Public Function StartsWith(e As Employee) As Boolean |
2971 | 2971 | |
2972 | 2972 | The C# language uses the [`this`](~/docs/csharp/language-reference/keywords/this.md) keyword to define the indexers instead of implementing the <xref:System.Collections.Generic.List%601.Item%2A> property. Visual Basic implements <xref:System.Collections.Generic.List%601.Item%2A> as a default property, which provides the same indexing functionality. |
2973 | 2973 | |
2974 | | - [!code-csharp[List`1_Class#2](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#2)] |
2975 | | - [!code-vb[List`1_Class#2](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#2)] |
2976 | | -[!code-csharp[List`1_Class#3](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#3)] |
2977 | | -[!code-vb[List`1_Class#3](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#3)] |
| 2974 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs" interactive="try-dotnet-method" id="Snippet2"::: |
| 2975 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet2"::: |
| 2976 | + [!code-csharp[List`1_Class#3](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#3)] |
| 2977 | + [!code-vb[List`1_Class#3](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#3)] |
2978 | 2978 | |
2979 | 2979 | ]]></format> |
2980 | 2980 | </remarks> |
@@ -3269,16 +3269,16 @@ Public Function StartsWith(e As Employee) As Boolean |
3269 | 3269 |
|
3270 | 3270 | The following example demonstrates how to add, remove, and insert a simple business object in a <xref:System.Collections.Generic.List%601>. |
3271 | 3271 | |
3272 | | - [!code-csharp[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/cs/program.cs#1)] |
3273 | | - [!code-vb[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/vb/module1.vb#1)] |
3274 | | - [!code-fsharp[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/fs/addremoveinsert.fs#1)] |
| 3272 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/cs/program.cs" interactive="try-dotnet" id="Snippet1"::: |
| 3273 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/vb/module1.vb" id="Snippet1"::: |
| 3274 | + :::code language="fsharp" source="~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/fs/addremoveinsert.fs" id="Snippet1"::: |
3275 | 3275 | |
3276 | 3276 | 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. |
3277 | 3277 | |
3278 | | - [!code-cpp[List\`1_Class#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp#1)] |
3279 | | - [!code-csharp-interactive[List\`1_Class#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs#1)] |
3280 | | - [!code-vb[List\`1_Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb#1)] |
3281 | | - [!code-fsharp[List\`1_Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs#1)] |
| 3278 | + :::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1"::: |
| 3279 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/List`1_Class/cs/source.cs" interactive="try-dotnet-method" id="Snippet1"::: |
| 3280 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1"::: |
| 3281 | + :::code language="fsharp" source="~/samples/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1"::: |
3282 | 3282 | |
3283 | 3283 | ]]></format> |
3284 | 3284 | </remarks> |
@@ -3350,10 +3350,10 @@ Public Function StartsWith(e As Employee) As Boolean |
3350 | 3350 | > In C# and Visual Basic, it is not necessary to create the `Predicate<string>` delegate (`Predicate(Of String)` in Visual Basic) explicitly. These languages infer the correct delegate from context, and create it automatically. |
3351 | 3351 | |
3352 | 3352 | Finally, the <xref:System.Collections.Generic.List%601.Exists%2A> method verifies that there are no strings in the list that end with "saurus". |
3353 | | - |
3354 | | - [!code-cpp[List\`1_FindEtAl#1](~/samples/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp#1)] |
3355 | | - [!code-csharp[List\`1_FindEtAl#1](~/samples/snippets/csharp/VS_Snippets_CLR/List`1_FindEtAl/cs/source.cs#1)] |
3356 | | - [!code-vb[List\`1_FindEtAl#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb#1)] |
| 3353 | + |
| 3354 | + :::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp" id="Snippet1"::: |
| 3355 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/List`1_FindEtAl/cs/source.cs" interactive="try-dotnet" id="Snippet1"::: |
| 3356 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb" id="Snippet1"::: |
3357 | 3357 | |
3358 | 3358 | ]]></format> |
3359 | 3359 | </remarks> |
@@ -3420,9 +3420,9 @@ Public Function StartsWith(e As Employee) As Boolean |
3420 | 3420 | ## Examples |
3421 | 3421 | The following example demonstrates how to add, remove, and insert a simple business object in a <xref:System.Collections.Generic.List%601>. |
3422 | 3422 | |
3423 | | - [!code-csharp[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/cs/program.cs#1)] |
3424 | | - [!code-vb[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/vb/module1.vb#1)] |
3425 | | - [!code-fsharp[System.Collections.Generic.List.AddRemoveInsert#1](~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/fs/addremoveinsert.fs#1)] |
| 3423 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/cs/program.cs" interactive="try-dotnet" id="Snippet1"::: |
| 3424 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/vb/module1.vb" id="Snippet1"::: |
| 3425 | + :::code language="fsharp" source="~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/fs/addremoveinsert.fs" id="Snippet1"::: |
3426 | 3426 | |
3427 | 3427 | ]]></format> |
3428 | 3428 | </remarks> |
|
0 commit comments