views:

23

answers:

1

I've read that in order to get caching and push performance when using an Interceptor Selector when using Castle Dynamic Proxy that I need to override GetType(), GetHashCode() and Equals()

Where can I find an example of or what would be the best, from a performing perspective, implementation?

+1  A: 

you can't override GetType, it's not virtual.

For the remaining ones, use the same technique you'd use for any other type. I generally make my selectors stateless, and implement the methods as this.GetType().GetHashCode() and This.GetType() == other.GetType()

Krzysztof Koźmic
For stateless selectors something as simple as this: public override bool Equals(object obj) { return this.GetType() == obj.GetType(); } public override int GetHashCode() { return this.GetType().GetHashCode(); }
Detroitpro

related questions