Beispiel #1
0
        public PoshMethodParameter[] GetParameters()
        {
            if (_hasParams.HasValue && !_hasParams.Value)
            {
                return(null);
            }

            ParameterInfo[] prms   = ((MethodInfo)base._backingField).GetParameters();
            var             newArr = new PoshMethodParameter[prms.Length];

            for (int i = 0; i < prms.Length; i++)
            {
                newArr[i] = prms[i];
            }
            return(newArr);
        }
Beispiel #2
0
        private string FormatDefinition(params PoshMethodParameter[] parameters)
        {
            string str = string.Empty;

            if (parameters != null && parameters.Length > 0)
            {
                var strs = new string[parameters.Length];
                for (int i = 0; i < parameters.Length; i++)
                {
                    PoshMethodParameter p = parameters[i];
                    strs[i] = string.Format(PARAMETER_FORMAT, GetTypeAlias(true, p.ParameterType).FirstOrDefault(), p.Name);
                }
                str = string.Join(", ", strs);
            }
            string formatted = string.Format(DEF_FORMAT, GetTypeAlias(true, this.ReturnType).FirstOrDefault(), this.Name, str);

            return(formatted);
        }