Exemplo n.º 1
0
        public EventGen WithStandardImplementation()
        {
            if ((object)handler == null)
            {
                if (IsStatic)
                {
                    handler = owner.Private.Static.Field(type, name);
                }
                else
                {
                    handler = owner.Private.Field(type, name);
                }

                CodeGen g = AddMethod();
                g.AssignAdd(handler, g.Arg("handler"));
                adder.GetMethodBuilder().SetImplementationFlags(MethodImplAttributes.IL | MethodImplAttributes.Managed | MethodImplAttributes.Synchronized);

                g = RemoveMethod();
                g.AssignSubtract(handler, g.Arg("handler"));
                remover.GetMethodBuilder().SetImplementationFlags(MethodImplAttributes.IL | MethodImplAttributes.Managed | MethodImplAttributes.Synchronized);
            }
            ;

            return(this);
        }