C#: Is it possible to use expressions or functions as keys in a dictionary?
- by Svish
Would it work to use Expression<Func<T>> or Func<T> as keys in a dictionary? For example to cache the result of heavy calculations.
For example, changing my very basic cache from a different question of mine a bit:
public static class Cache<T>
{
// Alternatively using Expression<Func<T>> instead
private…