Connect to COM events in C# - support both managed and unmanaged servers
问题 I'm writing C# code that needs to connect to COM events. I implemented the use of IConnectionPointContainer and IConnectionPoint thus: IConnectionPointContainer connectionPointContainer = internalGenerator as IConnectionPointContainer; if (connectionPointContainer == null) { Debug.Fail("The script generator doesn't support the required interface - IConnectionPointContainer"); throw new InvalidCastException("The script generator doesn't support the required interface -