TriAxis.RunSharp.EventGen.WithStandardImplementation C# (CSharp) Method

WithStandardImplementation() public method

public WithStandardImplementation ( ) : EventGen
return EventGen
		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;
		}