-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Documentation
-
None
This code example is invalid and won't be compiled https://mongodb.github.io/mongo-csharp-driver/2.10/reference/driver_core/events/.
public class MyEventSubscriber : IEventSubscriber { public bool TryGetEventHandler<TEvent>(out Action<TEvent> handler) { if(typeof(TEvent)) == typeof(ConnectionPoolAddedConnectionEvent)) { handler = (Action<TEvent>)HandleConnectionPoolAddedConnectionEvent; return true; } handler = null; return false; } private void HandleConnectionPoolAddedConnectionEvent(ConnectionPoolAddedConnectionEvent @event) { Console.WriteLine("Added a connection to the pool."); } }
It should be fixed.
Also, Handle methods should be public