Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int FindElementIndex(this int[] array, int element)
- {
- int defaultIndex = -1;
- if (array == null)
- {
- throw new ArgumentNullException("Массив не может быть null.", nameof(array));
- }
- for (int i = 0; i < array.Length; i++)
- {
- if (array[i] == element)
- {
- return i;
- }
- }
- return defaultIndex;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement