Esempio n. 1
0
            public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
            {
                var                props   = base.GetProperties(context, value, attributes);
                PSParamType        parm    = value as PSParamType;
                List <PSParameter> psprops = null;
                int                propcnt = props.Count;

                if (parm != null)
                {
                    psprops  = parm.Properties;
                    propcnt += psprops.Count;
                }
                PropertyDescriptor[] psdescs = new PropertyDescriptor[propcnt];
                props.CopyTo(psdescs, 0);

                if (psprops != null)
                {
                    int idx = props.Count;
                    foreach (PSParameter psparam in psprops)
                    {
                        psdescs[idx++] = new PSParamDescriptor(psparam);
                    }
                }
                return(new PropertyDescriptorCollection(psdescs));
            }
Esempio n. 2
0
            public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
            {
                var props = base.GetProperties(context, value, attributes);
                PSParamType parm = value as PSParamType;
                List<PSParameter> psprops = null;
                int propcnt = props.Count;
                if (parm != null)
                {
                    psprops = parm.Properties;
                    propcnt += psprops.Count;
                }
                PropertyDescriptor[] psdescs = new PropertyDescriptor[propcnt];
                props.CopyTo(psdescs, 0);

                if (psprops != null)
                {
                    int idx = props.Count;
                    foreach (PSParameter psparam in psprops)
                    {
                        psdescs[idx++] = new PSParamDescriptor(psparam);
                    }
                }
                return new PropertyDescriptorCollection(psdescs);
            }