I have a number of Func definitions (like 30) that checks for things, for instance:
IsLayerEnabled
IsEffectEnabled
...
I want to hash these in a Dictionary. Is it safe to just use:
IsLayerEnabled.GetHashCode()
etc
for each Func definition?
Or would they be the same hash value for each?
They will provide (typically) a different hash code for each delegate. However, Delegate.GetHashCode (which is what generates a hash for any delegate) does not prohibit hash collisions.
That being said,
Dictionary<T,U>handles hash collisions very well, and with 30 elements, you will be unlikely to have any real issues.