Changed implementation to try and find a matching contains method on the TKey type first (e.g. string) and use that instead of Enumerable