System.Reflection.Emit.OpCode.Equals C# (CSharp) Method

Equals() public method

public Equals ( System obj ) : bool
obj System
return bool
        public bool Equals(System.Reflection.Emit.OpCode obj) { throw null; }
        public override int GetHashCode() { throw null; }

Same methods

OpCode::Equals ( object obj ) : bool

Usage Example

Ejemplo n.º 1
0
        //
        //
        // Token resolution calls
        //
        //
        public override void Emit(OpCode opcode, MethodInfo meth)
        {
            ArgumentNullException.ThrowIfNull(meth);

            int           stackchange = 0;
            int           token;
            DynamicMethod?dynMeth = meth as DynamicMethod;

            if (dynMeth == null)
            {
                RuntimeMethodInfo?rtMeth = meth as RuntimeMethodInfo;
                if (rtMeth == null)
                {
                    throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(meth));
                }

                RuntimeType declaringType = rtMeth.GetRuntimeType();
                if (declaringType != null && (declaringType.IsGenericType || declaringType.IsArray))
                {
                    token = GetTokenFor(rtMeth, declaringType);
                }
                else
                {
                    token = GetTokenFor(rtMeth);
                }
            }
            else
            {
                // rule out not allowed operations on DynamicMethods
                if (opcode.Equals(OpCodes.Ldtoken) || opcode.Equals(OpCodes.Ldftn) || opcode.Equals(OpCodes.Ldvirtftn))
                {
                    throw new ArgumentException(SR.Argument_InvalidOpCodeOnDynamicMethod);
                }
                token = GetTokenFor(dynMeth);
            }

            EnsureCapacity(7);
            InternalEmit(opcode);

            if (opcode.StackBehaviourPush == StackBehaviour.Varpush &&
                meth.ReturnType != typeof(void))
            {
                stackchange++;
            }
            if (opcode.StackBehaviourPop == StackBehaviour.Varpop)
            {
                stackchange -= meth.GetParametersNoCopy().Length;
            }
            // Pop the "this" parameter if the method is non-static,
            //  and the instruction is not newobj/ldtoken/ldftn.
            if (!meth.IsStatic &&
                !(opcode.Equals(OpCodes.Newobj) || opcode.Equals(OpCodes.Ldtoken) || opcode.Equals(OpCodes.Ldftn)))
            {
                stackchange--;
            }

            UpdateStackSize(opcode, stackchange);

            PutInteger4(token);
        }
All Usage Examples Of System.Reflection.Emit.OpCode::Equals