private HandlerList GetComHandlerList(object instance) { HandlerList hl = (HandlerList)Marshal.GetComObjectData(instance, this); if (hl == null) { lock (_staticTarget) { hl = (HandlerList)Marshal.GetComObjectData(instance, this); if (hl == null) { hl = new ComHandlerList(); if (!Marshal.SetComObjectData(instance, this, hl)) { throw new COMException("Failed to set COM Object Data"); } } } } return(hl); }
private HandlerList GetComHandlerList(object instance) { HandlerList hl = (HandlerList)Marshal.GetComObjectData(instance, this); if (hl == null) { lock (_staticTarget) { hl = (HandlerList)Marshal.GetComObjectData(instance, this); if (hl == null) { hl = new ComHandlerList(); if (!Marshal.SetComObjectData(instance, this, hl)) { throw new COMException("Failed to set COM Object Data"); } } } } return hl; }