System.Reflection.Emit.SignatureHelper.AddArgument C# (CSharp) Method

AddArgument() public method

public AddArgument ( System clsArgument ) : void
clsArgument System
return void
        public void AddArgument(System.Type clsArgument) { }
        [System.Security.SecuritySafeCriticalAttribute]

Same methods

SignatureHelper::AddArgument ( System argument, System requiredCustomModifiers, System optionalCustomModifiers ) : void
SignatureHelper::AddArgument ( System argument, bool pinned ) : void

Usage Example

        /// <summary>Sets the name and lexical scope of this local variable.</summary>
        /// <param name="name">The name of the local variable. </param>
        /// <param name="startOffset">The beginning offset of the lexical scope of the local variable. </param>
        /// <param name="endOffset">The ending offset of the lexical scope of the local variable. </param>
        /// <exception cref="T:System.InvalidOperationException">The containing type has been created with <see cref="M:System.Reflection.Emit.TypeBuilder.CreateType" />.-or- There is no symbolic writer defined for the containing module. </exception>
        /// <exception cref="T:System.NotSupportedException">This local is defined in a dynamic method, rather than in a method of a dynamic type.</exception>
        // Token: 0x060049F6 RID: 18934 RVA: 0x0010B4A8 File Offset: 0x001096A8
        public void SetLocalSymInfo(string name, int startOffset, int endOffset)
        {
            MethodBuilder methodBuilder = this.m_methodBuilder as MethodBuilder;

            if (methodBuilder == null)
            {
                throw new NotSupportedException();
            }
            ModuleBuilder moduleBuilder = (ModuleBuilder)methodBuilder.Module;

            if (methodBuilder.IsTypeCreated())
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TypeHasBeenCreated"));
            }
            if (moduleBuilder.GetSymWriter() == null)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotADebugModule"));
            }
            SignatureHelper fieldSigHelper = SignatureHelper.GetFieldSigHelper(moduleBuilder);

            fieldSigHelper.AddArgument(this.m_localType);
            int num;

            byte[] sourceArray = fieldSigHelper.InternalGetSignature(out num);
            byte[] array       = new byte[num - 1];
            Array.Copy(sourceArray, 1, array, 0, num - 1);
            int currentActiveScopeIndex = methodBuilder.GetILGenerator().m_ScopeTree.GetCurrentActiveScopeIndex();

            if (currentActiveScopeIndex == -1)
            {
                methodBuilder.m_localSymInfo.AddLocalSymInfo(name, array, this.m_localIndex, startOffset, endOffset);
                return;
            }
            methodBuilder.GetILGenerator().m_ScopeTree.AddLocalSymInfoToCurrentScope(name, array, this.m_localIndex, startOffset, endOffset);
        }
All Usage Examples Of System.Reflection.Emit.SignatureHelper::AddArgument