Ejemplo n.º 1
0
        // Get the properties for an object.
        public override PropertyDescriptorCollection GetProperties
            (ITypeDescriptorContext context, Object value,
            Attribute[] attributes)
        {
            Array array = (value as Array);

            if (array == null)
            {
                return(new PropertyDescriptorCollection(null));
            }
            int len = array.GetLength(0);

            PropertyDescriptor[] descs;
            descs = new PropertyDescriptor [len];
            int index;

            for (index = 0; index < len; ++index)
            {
                descs[index] = new ArrayElementDescriptor
                                   (array.GetType(),
                                   array.GetType().GetElementType(),
                                   index, "[" + index.ToString() + "]");
            }
            return(new PropertyDescriptorCollection(descs));
        }
	// Get the properties for an object.
	public override PropertyDescriptorCollection GetProperties
				(ITypeDescriptorContext context, Object value,
				 Attribute[] attributes)
			{
				Array array = (value as Array);
				if(array == null)
				{
					return new PropertyDescriptorCollection(null);
				}
				int len = array.GetLength(0);
				PropertyDescriptor[] descs;
				descs = new PropertyDescriptor [len];
				int index;
				for(index = 0; index < len; ++index)
				{
					descs[index] = new ArrayElementDescriptor
						(array.GetType(),
						 array.GetType().GetElementType(),
						 index, "[" + index.ToString() + "]");
				}
				return new PropertyDescriptorCollection(descs);
			}