An Upgrade on using a Predicate as a Key to a Dictionary

In an earlier post, I discussed using a Predicate<string> as a key to a Dictionary.
Dictionary<Predicate<string>, string> : that utilizes a where clause to determine TRUE.

This post is a slight upgrade to the concept where I make an (almost) 1-liner class and Extension Method that handles generics for both the subject-of-the-Predicate
as well as the Type of the Key and the Type of the value in the pseudo-Dictionary.

The Dictionary reference (ha ha) is used for syntax purposes and the actual implementation of something like this would expect the programmer to iterate through the collection rather than attempt a direct key-to-result attempt at the pseudo-Dictionary.

I changed this (15-SEP-2015) because a comment from a reader let me know my intention was not clear.

  Since it’s easier to show than explain:

 
using System;
using System.Collections.Generic;
using System.Linq;
 
namespace Predicize
{
	public static class CPredicize
	{
		public static U Predicize<T, U>(this IEnumerable<KeyValuePair<Predicate<T>, U>> map, T keyCandidate)
		{
			return map.Where(kvp => kvp.Key(keyCandidate)).First().Value;
		}
	}
}
This class exposes an extension method named Predicize that partners with an IEnumerable<KeyValuePair<Predicate<T>, U>> (like a Dictionary with a predicate of T as its key). 
Given an IEnumerable that meets the implied interface, the method will return the first value where the Predicate under the key returns true when executed.
It is up to the developer to ensure a default condition exists to prevent the construct from not successfully returning true.
using System;
using System.Collections.Generic;
using System.Linq;
 
namespace PlayWithPredicize
{
	using Predicize;
 
	class CPlayWithPredicize
	{
		private static IEnumerable<KeyValuePair<Predicate<int>, string>> map_fni2strSpecial =
			new Dictionary<Predicate<int>, string> // <-- for syntax purposes only
		{
			{i => i.Equals(4), "Good"},
			{i => i.Equals(5), "Super"},
			{i => i.Equals(7), "Perfect"},
			{i => i.Equals(9), "Fantastic"},
			{i => i.Equals(10), "Stupendous"},
			{i => true, "OK"},
		};
 
		static void Main(string[] args)
		{
			Console.WriteLine
			(
				string.Join(
					Environment.NewLine,
					Enumerable.Range(0, 10)
					.Select(i =>
						string.Format("{0} = {1}", i, map_fni2strSpecial.Predicize(i))).ToArray())
			);
		}
	}
}

 

The preceding code loops through the numbers 0-9 and matches those numbers with result of the call to the Predicize extension method.
Since, 0 will not be found in the dictionary, the result will be “OK”.  When 4 is encountered, it returns “Good”.
Here is the result of the full run:

PredicateResults

 

The results are processed as strings, but could easily be any other type to include delegates/funcs/methods, etc.

«September»
SunMonTueWedThuFriSat
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910