Mono.CSharp.DelegateCreation.Emit C# (CSharp) Method

Emit() public method

public Emit ( EmitContext ec ) : void
ec EmitContext
return void
		public override void Emit (EmitContext ec)
		{
			if (method_group.InstanceExpression == null)
				ec.Emit (OpCodes.Ldnull);
			else
				method_group.InstanceExpression.Emit (ec);

			var delegate_method = method_group.BestCandidate;

			// Any delegate must be sealed
			if (!delegate_method.DeclaringType.IsDelegate && delegate_method.IsVirtual && !method_group.IsBase) {
				ec.Emit (OpCodes.Dup);
				ec.Emit (OpCodes.Ldvirtftn, delegate_method);
			} else {
				ec.Emit (OpCodes.Ldftn, delegate_method);
			}

			ec.Emit (OpCodes.Newobj, constructor_method);
		}