Пример #1
0
        public Param(uint token, Method enclosing)
            : base(token)
        {
            char[] szName = new char[1024];
            uint   outNameSize;
            uint   tokmethod, seq, attr, constValueType, constValueSize;
            IntPtr constValue;

            // from the Param table
            if (((CorTokenType)token & CorTokenType.mdtMask) != CorTokenType.mdtParamDef)
            {
                throw new ArgumentException
                          ("Invalid token type while creating a Param");
            }

            Context.importIntf.GetParamProps
                (this.token, out tokmethod, out seq, szName, 1024, out outNameSize,
                out attr, out constValueType, out constValue, out constValueSize);

            if ((int)outNameSize == 0)
            {
                throw new ArgumentException("invalid name as parameter");
            }
            else
            {
                this.name = Decoder.ReadString(szName, (int)outNameSize);
            }

            this.flags  = (CorParamAttr)attr;
            this.method = enclosing;
        }
Пример #2
0
        public string GetAttributeText()
        {
            AttributeTextBuilder.Length = 0;
            CorParamAttr refParam = (CorParamAttr.pdIn | CorParamAttr.pdOut);

            if ((AttributeFlags & refParam) == refParam)
            {
                AttributeTextBuilder.Append("ref ");
            }
            else if ((AttributeFlags & CorParamAttr.pdOut) == CorParamAttr.pdOut)
            {
                AttributeTextBuilder.Append("[out] ");
            }

            if ((AttributeFlags & CorParamAttr.pdIn) == CorParamAttr.pdIn)
            {
                AttributeTextBuilder.Append("[in] ");
            }

            if ((AttributeFlags & CorParamAttr.pdOptional) == CorParamAttr.pdOptional)
            {
                AttributeTextBuilder.Append("[opt] ");
            }

            return(AttributeTextBuilder.ToString());
        }
Пример #3
0
 public Param(IntPtr sig, ref int idx, Method enclosing)
     : base(0)
 {
     //  creation of unnamed parameter
     this.name   = null;
     this.flags  = CorParamAttr.pdIn;
     this.method = enclosing;
     this.SetSig(sig, ref idx, enclosing);
 }