Yes, a
can be GC'd in your example. It won't cause any problems either. Think about it.
Class1 a = new Class1();
Class2 b = new Class2();
a.SomeEvent += b.SomeMethod;
In this example, a
holds a reference to b
, but not the other way round. The a.SomeEvent
member is like a List<delegate>
(or close to it). It holds references to all the subscribers, so they can be called when needed.
So when a
needs to be GC'd, it can be. It will be destroyed, along with the list of subscribers. b
will remain happily alive without any problems.
The other way won't work though - b
cannot be collected, because a
is still holding a reference to it. If it were collected, then a
would get a reference to somewhere nonexistant, and the next attempt to raise the event would explode.