|
4754 | 4754 | </AssemblyInfo>
|
4755 | 4755 | <Docs>
|
4756 | 4756 | <summary>Searches for the specified object and returns the index of its first occurrence in a one-dimensional array or in a range of elements in the array.</summary>
|
| 4757 | + <remarks> |
| 4758 | + <format type="text/markdown"><] |
| 4763 | + |
| 4764 | + ]]></format> |
| 4765 | + </remarks> |
4757 | 4766 | </Docs>
|
4758 | 4767 | </MemberGroup>
|
4759 | 4768 | <Member MemberName="IndexOf">
|
|
4824 | 4833 | - <xref:System.Array.IndexOf%28System.Array%2CSystem.Object%2CSystem.Int32%2CSystem.Int32%29>, to determine the first occurrence of the string "the" in a string array from the element that follows the last successful match to the end of the array.
|
4825 | 4834 |
|
4826 | 4835 | [!code-cpp[Classic Array.IndexOf Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp#1)]
|
4827 |
| - [!code-csharp[Classic Array.IndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CS/source.cs#1)] |
| 4836 | + [!code-csharp-interactive[Classic Array.IndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CS/source.cs#1)] |
4828 | 4837 | [!code-vb[Classic Array.IndexOf Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/VB/source.vb#1)]
|
4829 | 4838 |
|
4830 | 4839 | ]]></format>
|
|
4908 | 4917 | - <xref:System.Array.IndexOf%28System.Array%2CSystem.Object%2CSystem.Int32%2CSystem.Int32%29>, to determine the first occurrence of the string "the" in a string array from the element that follows the last successful match to the end of the array.
|
4909 | 4918 |
|
4910 | 4919 | [!code-cpp[Classic Array.IndexOf Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp#1)]
|
4911 |
| - [!code-csharp[Classic Array.IndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CS/source.cs#1)] |
| 4920 | + [!code-csharp-interactive[Classic Array.IndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CS/source.cs#1)] |
4912 | 4921 | [!code-vb[Classic Array.IndexOf Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/VB/source.vb#1)]
|
4913 | 4922 |
|
4914 | 4923 | ]]></format>
|
|
5000 | 5009 | - <xref:System.Array.IndexOf%28System.Array%2CSystem.Object%2CSystem.Int32%2CSystem.Int32%29>, to determine the first occurrence of the string "the" in a string array from the element that follows the last successful match to the end of the array. To determine the value of the `count` argument, it subtracts the upper bound of the array from the starting index and adds one.
|
5001 | 5010 |
|
5002 | 5011 | [!code-cpp[Classic Array.IndexOf Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp#1)]
|
5003 |
| - [!code-csharp[Classic Array.IndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CS/source.cs#1)] |
| 5012 | + [!code-csharp-interactive[Classic Array.IndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CS/source.cs#1)] |
5004 | 5013 | [!code-vb[Classic Array.IndexOf Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/VB/source.vb#1)]
|
5005 | 5014 |
|
5006 | 5015 | ]]></format>
|
|
5082 | 5091 | The following example demonstrates all three generic overloads of the <xref:System.Array.IndexOf%2A> method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The <xref:System.Array.IndexOf%60%601%28%60%600%5B%5D%2C%60%600%29> method overload searches the array from the beginning, and finds the first occurrence of the string. The <xref:System.Array.IndexOf%60%601%28%60%600%5B%5D%2C%60%600%2CSystem.Int32%29> method overload is used to search the array beginning with index location 3 and continuing to the end of the array, and finds the second occurrence of the string. Finally, the <xref:System.Array.IndexOf%60%601%28%60%600%5B%5D%2C%60%600%2CSystem.Int32%2CSystem.Int32%29> method overload is used to search a range of two entries, beginning at index location two; it returns -1 because there are no instances of the search string in that range.
|
5083 | 5092 |
|
5084 | 5093 | [!code-cpp[Array_IndexOf#1](~/samples/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp#1)]
|
5085 |
| - [!code-csharp[Array_IndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_IndexOf/cs/source.cs#1)] |
| 5094 | + [!code-csharp-interactive[Array_IndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_IndexOf/cs/source.cs#1)] |
5086 | 5095 | [!code-vb[Array_IndexOf#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Array_IndexOf/vb/source.vb#1)]
|
5087 | 5096 |
|
5088 | 5097 | ]]></format>
|
|
5156 | 5165 | The following example demonstrates all three generic overloads of the <xref:System.Array.IndexOf%2A> method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The <xref:System.Array.IndexOf%60%601%28%60%600%5B%5D%2C%60%600%29> method overload searches the array from the beginning, and finds the first occurrence of the string. The <xref:System.Array.IndexOf%60%601%28%60%600%5B%5D%2C%60%600%2CSystem.Int32%29> method overload is used to search the array beginning with index location 3 and continuing to the end of the array, and finds the second occurrence of the string. Finally, the <xref:System.Array.IndexOf%60%601%28%60%600%5B%5D%2C%60%600%2CSystem.Int32%2CSystem.Int32%29> method overload is used to search a range of two entries, beginning at index location two; it returns -1 because there are no instances of the search string in that range.
|
5157 | 5166 |
|
5158 | 5167 | [!code-cpp[Array_IndexOf#1](~/samples/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp#1)]
|
5159 |
| - [!code-csharp[Array_IndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_IndexOf/cs/source.cs#1)] |
| 5168 | + [!code-csharp-interactive[Array_IndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_IndexOf/cs/source.cs#1)] |
5160 | 5169 | [!code-vb[Array_IndexOf#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Array_IndexOf/vb/source.vb#1)]
|
5161 | 5170 |
|
5162 | 5171 | ]]></format>
|
|
5234 | 5243 | The following example demonstrates all three generic overloads of the <xref:System.Array.IndexOf%2A> method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The <xref:System.Array.IndexOf%60%601%28%60%600%5B%5D%2C%60%600%29> method overload searches the array from the beginning, and finds the first occurrence of the string. The <xref:System.Array.IndexOf%60%601%28%60%600%5B%5D%2C%60%600%2CSystem.Int32%29> method overload is used to search the array beginning with index location 3 and continuing to the end of the array, and finds the second occurrence of the string. Finally, the <xref:System.Array.IndexOf%60%601%28%60%600%5B%5D%2C%60%600%2CSystem.Int32%2CSystem.Int32%29> method overload is used to search a range of two entries, beginning at index location two; it returns -1 because there are no instances of the search string in that range.
|
5235 | 5244 |
|
5236 | 5245 | [!code-cpp[Array_IndexOf#1](~/samples/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp#1)]
|
5237 |
| - [!code-csharp[Array_IndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_IndexOf/cs/source.cs#1)] |
| 5246 | + [!code-csharp-interactive[Array_IndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_IndexOf/cs/source.cs#1)] |
5238 | 5247 | [!code-vb[Array_IndexOf#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Array_IndexOf/vb/source.vb#1)]
|
5239 | 5248 |
|
5240 | 5249 | ]]></format>
|
|
5505 | 5514 | </AssemblyInfo>
|
5506 | 5515 | <Docs>
|
5507 | 5516 | <summary>Returns the index of the last occurrence of a value in a one-dimensional <see cref="T:System.Array" /> or in a portion of the <see cref="T:System.Array" />.</summary>
|
| 5517 | + <remarks> |
| 5518 | + <format type="text/markdown"><] |
| 5523 | + |
| 5524 | + ]]></format> |
| 5525 | + </remarks> |
5508 | 5526 | </Docs>
|
5509 | 5527 | </MemberGroup>
|
5510 | 5528 | <Member MemberName="LastIndexOf">
|
|
5575 | 5593 | The following code example shows how to determine the index of the last occurrence of a specified element in an array.
|
5576 | 5594 |
|
5577 | 5595 | [!code-cpp[Classic Array.LastIndexOf Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp#1)]
|
5578 |
| - [!code-csharp[Classic Array.LastIndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CS/source.cs#1)] |
| 5596 | + [!code-csharp-interactive[Classic Array.LastIndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CS/source.cs#1)] |
5579 | 5597 | [!code-vb[Classic Array.LastIndexOf Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/VB/source.vb#1)]
|
5580 | 5598 |
|
5581 | 5599 | ]]></format>
|
|
5656 | 5674 | The following code example shows how to determine the index of the last occurrence of a specified element in an array.
|
5657 | 5675 |
|
5658 | 5676 | [!code-cpp[Classic Array.LastIndexOf Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp#1)]
|
5659 |
| - [!code-csharp[Classic Array.LastIndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CS/source.cs#1)] |
| 5677 | + [!code-csharp-interactive[Classic Array.LastIndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CS/source.cs#1)] |
5660 | 5678 | [!code-vb[Classic Array.LastIndexOf Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/VB/source.vb#1)]
|
5661 | 5679 |
|
5662 | 5680 | ]]></format>
|
|
5744 | 5762 | The following code example shows how to determine the index of the last occurrence of a specified element in an array. Note that the <xref:System.Array.LastIndexOf%2A> method is a backward search; therefore, `count` must be less than or equal to (`startIndex` minus the lower bound of the array plus 1).
|
5745 | 5763 |
|
5746 | 5764 | [!code-cpp[Classic Array.LastIndexOf Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp#1)]
|
5747 |
| - [!code-csharp[Classic Array.LastIndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CS/source.cs#1)] |
| 5765 | + [!code-csharp-interactive[Classic Array.LastIndexOf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CS/source.cs#1)] |
5748 | 5766 | [!code-vb[Classic Array.LastIndexOf Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/VB/source.vb#1)]
|
5749 | 5767 |
|
5750 | 5768 | ]]></format>
|
|
5828 | 5846 | The following code example demonstrates all three generic overloads of the <xref:System.Array.LastIndexOf%2A> method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The <xref:System.Array.LastIndexOf%60%601%28%60%600%5B%5D%2C%60%600%29> method overload searches the entire array from the end, and finds the second occurrence of the string. The <xref:System.Array.LastIndexOf%60%601%28%60%600%5B%5D%2C%60%600%2CSystem.Int32%29> method overload is used to search the array backward beginning with index location 3 and continuing to the beginning of the array, and finds the first occurrence of the string. Finally, the <xref:System.Array.LastIndexOf%60%601%28%60%600%5B%5D%2C%60%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.
|
5829 | 5847 |
|
5830 | 5848 | [!code-cpp[Array_LastIndexOf#1](~/samples/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp#1)]
|
5831 |
| - [!code-csharp[Array_LastIndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_LastIndexOf/cs/source.cs#1)] |
| 5849 | + [!code-csharp-interactive[Array_LastIndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_LastIndexOf/cs/source.cs#1)] |
5832 | 5850 | [!code-vb[Array_LastIndexOf#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Array_LastIndexOf/vb/source.vb#1)]
|
5833 | 5851 |
|
5834 | 5852 | ]]></format>
|
|
5902 | 5920 | The following code example demonstrates all three generic overloads of the <xref:System.Array.LastIndexOf%2A> method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The <xref:System.Array.LastIndexOf%60%601%28%60%600%5B%5D%2C%60%600%29> method overload searches the entire array from the end, and finds the second occurrence of the string. The <xref:System.Array.LastIndexOf%60%601%28%60%600%5B%5D%2C%60%600%2CSystem.Int32%29> method overload is used to search the array backward beginning with index location 3 and continuing to the beginning of the array, and finds the first occurrence of the string. Finally, the <xref:System.Array.LastIndexOf%60%601%28%60%600%5B%5D%2C%60%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.
|
5903 | 5921 |
|
5904 | 5922 | [!code-cpp[Array_LastIndexOf#1](~/samples/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp#1)]
|
5905 |
| - [!code-csharp[Array_LastIndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_LastIndexOf/cs/source.cs#1)] |
| 5923 | + [!code-csharp-interactive[Array_LastIndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_LastIndexOf/cs/source.cs#1)] |
5906 | 5924 | [!code-vb[Array_LastIndexOf#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Array_LastIndexOf/vb/source.vb#1)]
|
5907 | 5925 |
|
5908 | 5926 | ]]></format>
|
|
5980 | 5998 | The following code example demonstrates all three generic overloads of the <xref:System.Array.LastIndexOf%2A> method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The <xref:System.Array.LastIndexOf%60%601%28%60%600%5B%5D%2C%60%600%29> method overload searches the entire array from the end, and finds the second occurrence of the string. The <xref:System.Array.LastIndexOf%60%601%28%60%600%5B%5D%2C%60%600%2CSystem.Int32%29> method overload is used to search the array backward beginning with index location 3 and continuing to the beginning of the array, and finds the first occurrence of the string. Finally, the <xref:System.Array.LastIndexOf%60%601%28%60%600%5B%5D%2C%60%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.
|
5981 | 5999 |
|
5982 | 6000 | [!code-cpp[Array_LastIndexOf#1](~/samples/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp#1)]
|
5983 |
| - [!code-csharp[Array_LastIndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_LastIndexOf/cs/source.cs#1)] |
| 6001 | + [!code-csharp-interactive[Array_LastIndexOf#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_LastIndexOf/cs/source.cs#1)] |
5984 | 6002 | [!code-vb[Array_LastIndexOf#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Array_LastIndexOf/vb/source.vb#1)]
|
5985 | 6003 |
|
5986 | 6004 | ]]></format>
|
|
0 commit comments