Question: I was wondering how I would go about setting up the virtual hosts so that I just have to enter www.mydomain.com:9090 to go to phpmyadmin. This is how I have my vhosts set up right now in httpd.conf:

```
<VirtualHost *:80>
    DocumentRoot /var/www/html/
    ServerName mydomain.com
    ServerAlias www.mydomain.com
</VirtualHost>

<VirtualHost *:9090>
    DocumentRoot /usr/share/phpMyAdmin/
    ServerName mydomain.com
    ServerAlias www.mydomain.com
</VirtualHost>

```

This does not seem to be working.

Answer: 
When unhooking an event, it needs to be the same delegate. Like this:

```
public class Foo
{
     private MyDelegate Foo = ClientEntityCache_CacheCleared;
     public void WorkItem()
     {
         ClientEntityCache.EntityCacheCleared += Foo;
     }

     public void Dispose()
     {
         ClientEntityCache.EntityCacheCleared -= Foo;
     }
}

```

The reason is, what you are using is syntactic sugar for this:

```
public class Foo
{
     public void WorkItem()
     {
         ClientEntityCache.EntityCacheCleared +=
new MyDelegate(ClientEntityCache_CacheCleared);
     }

     public void Dispose()
     {
         ClientEntityCache.EntityCacheCleared -=
new MyDelegate(ClientEntityCache_CacheCleared);
     }
}

```

So the `-=` doesn't unhook the original one you subscribed with because they are different delegates.
Dispose won't get called by the GC if the instance is being kept alive by the event handlers, as it is still being referenced by the source of the events.

If you called your Dispose method yourself, the references would then go out of scope.