title: Check if list contains element that contains a string and get that element
body: <p>While searching for an answer to this question, I've run into similar ones utilizing LINQ but I haven't been able to fully understand them (and thus, implement them), as I'm not familiarized with it. What I would like to, basically, is this:</p>
  
  <ol>
  <li>Check if any element of a list contains a specific string.</li>
  <li>If it does, get that element.</li>
  </ol>
  
  <p>I honestly don't know how I would go about doing that. What I can come up with is this (not working, of course):</p>
  
  <pre><code>if (myList.Contains(myString))
      string element = myList.ElementAt(myList.IndexOf(myString));
  </code></pre>
  
  <p>I know WHY it does not work:</p>
  
  <ul>
  <li><code>myList.Contains()</code> does not return <code>true</code>, since it will check for if a whole element of the list matches the string I specified.</li>
  <li><code>myList.IndexOf()</code> will not find an occurrence, since, as it is the case again, it will check for an element matching the string.</li>
  </ul>
  
  <p>Still, I have no clue how to solve this problem, but I figure I'll have to use LINQ as suggested in similar questions to mine. That being said, if that's the case here, I'd like for the answerer to explain to me the use of LINQ in their example (as I said, I haven't bothered with it in my time with C#). Thank you in advance guys (and gals?).</p>
  
  <p>EDIT: I have come up with a solution; just loop through the list, check if current element contains the string and then set a string equal to the current element. I'm wondering, though, is there a more efficient way than this?</p>
  
  <pre><code>string myString = "bla";
  string element = "";
  
  for (int i = 0; i &lt; myList.Count; i++)
  {
      if (myList[i].Contains(myString))
          element = myList[i];
  }
  </code></pre>