예제 #1
0
        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);
        }
예제 #2
0
        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;
        }