Suppose I've an Arraylist(arr1) like the below
 "String1 is present"
 "String2 is present"
 "String3 is present"
i wanted to see if 'String2' is present in this arraylist. i've done something like the below:
        var containsstringmatch = arr1.OfType<string>().Any(arg=>arg.Contains("String2"));
        if (containsstringmatch==true)
        {
            IEnumerable v1 = arr1.OfType<string>().Where(arg=>arg.Contains("String2"));
            foreach (string s in v1)
            {
                st1 = s;
            }
            Console.WriteLine(st1);
        }
which gives me the below output which is good:
"String2 is present"
I wanted to see if this can be achieved without me using the foreach loop. Can someone please provide suggestions as to how to do it.
Thanks
 
     
     
    