I want to find a way to convert object[] elements dynamically and find string "needle" my problem come from first array case
var haystack_1 = new object[]{'3', "123124234", null, "needle", "world", "hay", 2, '3', true, false};
var haystack_2 = new object[]{"283497238987234", "a dog", "a cat", "some random junk", "a piece of hay", "needle", "something somebody lost a while ago"};
var haystack_3 = new object[]{1,2,3,4,5,6,7,8,8,7,5,4,3,4,5,6,67,5,5,3,3,4,2,34,234,23,4,234,324,324,"needle",1,2,3,4,5,5,6,5,4,32,3,45,54};
var index = Array.FindIndex(haystack_1,item => item.ToString().Equals("needle"));
Console.WriteLine(index);
error
Run-time exception (line 13): Object reference not set to an instance of an object.
Stack Trace:
[System.NullReferenceException: Object reference not set to an instance of an object.] at Program.b__0(Object item) :line 13 at System.Array.FindIndex[T](T[] array, Int32 startIndex, Int32 count, Predicate
1 match) at System.Array.FindIndex[T](T[] array, Predicate
1 match) at Program.Main() :line 13