Skip to content

Instantly share code, notes, and snippets.

@DanPuzey
Created January 9, 2015 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanPuzey/0fbf9e3d93970b2fa6bc to your computer and use it in GitHub Desktop.
Save DanPuzey/0fbf9e3d93970b2fa6bc to your computer and use it in GitHub Desktop.
IEnumerable<string> ErrorsFor3(string[] hayStack, string[] needles, Func<string, string, string> errorMessageGenerator)
{
return hayStack.Select(hay => needle.FirstOrDefault(hay.Contains))
.Where(n => n != null)
.Select(matchingNeedle => errormessageGenerator(hay, matchingNeedle));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment