Taking item from string array that *might* be there
<p>I have a string array, and it may contain an element with the text "mytext" within the string. eg:</p>

<pre><code>mystringarray
{
    [0] =&gt; "hello world";
    [1] =&gt; "some of mytext";
}
</code></pre>

<p>I also have an array that doesn't have the mytext text in it.</p>

<pre><code>mystringarray
{
    [0] =&gt; "hello world";
    [1] =&gt; "some of notmy";
}
</code></pre>

<p>My problem is when I use:</p>

<pre><code>string mytextdata = mystringarray.Single&lt;string&gt;(t =&gt; t.Contains("mytext")).ToString();
</code></pre>

<p>I get an exception for the second array as it can't find an element that matches the expression.</p>

<p>Is there a quick way I can edit this one line to not throw an exception if it finds nothing, and instead just ignore? I have a lot of these lines and I don't want to have to wrap each in an if statement.</p>

<p>Apologies if question isn't clear.</p>
