コード例 #1
0
        private static MyParameterAttributes GetMyParameterAttributes(ParameterDefinition parameterDefinition)
        {
            MyParameterAttributes myParameterAttributes = MyParameterAttributes.None;

            string parameterTypeName = parameterDefinition.ParameterType.FullName == null ? parameterDefinition.ParameterType.Name : parameterDefinition.ParameterType.FullName;
            bool   isRef             = parameterTypeName.EndsWith("&");

            if (isRef)
            {
                if (parameterDefinition.IsOut)
                {
                    myParameterAttributes |= MyParameterAttributes.Out;
                }
                else
                {
                    myParameterAttributes |= MyParameterAttributes.Ref;
                }
            }

            if (Utils.ContainsCustomAttribute(parameterDefinition, "System.ParamArrayAttribute"))
            {
                myParameterAttributes |= MyParameterAttributes.Params;
            }

            return(myParameterAttributes);
        }
コード例 #2
0
        public MyParameterInfo(ParameterDefinition parameterDefinition)
        {
            this.name = parameterDefinition.Name;
            string[] readableForms = Tools.GetHumanReadableForms(parameterDefinition.ParameterType);
            this.typeFullName = readableForms[0];
            this.typeFullNameWithXmlCompatibleArrayStrings = readableForms[1];
            this.attributes = GetMyParameterAttributes(parameterDefinition);

            this.CheckSupport(parameterDefinition.Attributes);
        }
コード例 #3
0
    public MyParameterInfo(ParameterDefinition parameterDefinition)
    {
      this.name = parameterDefinition.Name;
      string[] readableForms = Tools.GetHumanReadableForms(parameterDefinition.ParameterType);
      this.typeFullName = readableForms[0];
      this.typeFullNameWithXmlCompatibleArrayStrings = readableForms[1];
      this.attributes = GetMyParameterAttributes(parameterDefinition);

      this.CheckSupport(parameterDefinition.Attributes);
    }
コード例 #4
0
        private static string MyParameterAttributesToString(MyParameterAttributes myParameterAttributes)
        {
            StringBuilder sb = new StringBuilder();

            if ((myParameterAttributes & MyParameterAttributes.Params) != 0)
            {
                sb.Append("params ");
            }
            if ((myParameterAttributes & MyParameterAttributes.Ref) != 0)
            {
                sb.Append("ref ");
            }
            if ((myParameterAttributes & MyParameterAttributes.Out) != 0)
            {
                sb.Append("out ");
            }

            if (sb.Length > 0)
            {
                sb.Length = sb.Length - 1;
            }

            return(sb.ToString());
        }
コード例 #5
0
    private static string MyParameterAttributesToString(MyParameterAttributes myParameterAttributes)
    {
      StringBuilder sb = new StringBuilder();

      if ((myParameterAttributes & MyParameterAttributes.Params) != 0) { sb.Append("params "); }
      if ((myParameterAttributes & MyParameterAttributes.Ref) != 0) { sb.Append("ref "); }
      if ((myParameterAttributes & MyParameterAttributes.Out) != 0) { sb.Append("out "); }

      if (sb.Length > 0)
      {
        sb.Length = sb.Length - 1;
      }

      return sb.ToString();
    }