Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: C# | Size: 0.36 KB | Hits: 24 | Expires: Never
Copy text to clipboard
  1. List<string> firstColl = new List<string> { "batrado", "test", "proba" };
  2. List<string> secondColl = new List<string> { @"\\comp53\batrado", @"\\comp53\pesho" };
  3. string result = firstColl.FirstOrDefault(s => secondColl.Any(s1 => s1.Contains(s)));
  4. if (result != null) {
  5.     // result contains first item found in first collection
  6. } else {
  7.     // No matches found
  8. }