Codes. Ret Field
Returns from the current method, pushing a return value (if present) from the callee's evaluation stack onto the caller's evaluation stack.
public: static initonly System::Reflection::Emit::OpCode Ret;
public static readonly System.Reflection.Emit.OpCode Ret;
staticval mutable Ret : System.Reflection.Emit.OpCode
Public Shared ReadOnly Ret As OpCode
The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:
|2A||ret||Returns from method, possibly returning a value.|
The stack transitional behavior, in sequential order, is:
The return value is popped from the callee evaluation stack.
The return value obtained in step 1 is pushed onto the caller evaluation stack.
If the return value is not present on the callee evaluation stack, no value is returned (no stack transition behaviors for either the callee or caller method).
The type of the return value, if any, of the current method determines the type of value to be fetched from the top of the stack and copied onto the stack of the method that called the current method. The evaluation stack for the current method must be empty except for the value to be returned.
ret instruction cannot be used to transfer control out of a
finally block. From within a
catch, use the Leave instruction with a destination of a
ret instruction that is outside all enclosing exception blocks. Because the
finally blocks are logically part of exception handling and not the method in which their code is embedded, correctly generated Microsoft Intermediate Language (MSIL) instructions do not perform a method return from within a
The following Emit method overload can use the