public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
            {
                var properties = _inner.GetProperties()
                                 .Cast <PropertyDescriptor>()
                                 .Where(prop => prop.Name != "Values")
                                 .Select(prop => (PropertyDescriptor) new ExistingPropertyDescriptor(prop))
                                 .ToList();

                if (_instance != null)
                {
                    foreach (var pair in _instance.Values)
                    {
                        PropertyDescriptor prop;

                        if (pair.Value is SDataPayload)
                        {
                            prop = new VirtualPropertyDescriptor(pair.Key,
                                                                 typeof(SDataPayload),
                                                                 typeof(ExpandableObjectConverter));
                        }
                        else if (pair.Value is SDataPayloadCollection)
                        {
                            prop = new VirtualPropertyDescriptor(pair.Key,
                                                                 typeof(SDataPayloadCollection),
                                                                 typeof(ExpandablePayloadCollectionConverter));
                        }
                        else
                        {
                            prop = new VirtualPropertyDescriptor(pair.Key, typeof(string), null);
                        }

                        properties.Add(prop);
                    }
                }

                return(new PropertyDescriptorCollection(properties.ToArray()));
            }
            public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
            {
                var properties = _inner.GetProperties()
                    .Cast<PropertyDescriptor>()
                    .Where(prop => prop.Name != "Values")
                    .Select(prop => (PropertyDescriptor) new ExistingPropertyDescriptor(prop))
                    .ToList();

                if (_instance != null)
                {
                    foreach (var pair in _instance.Values)
                    {
                        PropertyDescriptor prop;

                        if (pair.Value is SDataPayload)
                        {
                            prop = new VirtualPropertyDescriptor(pair.Key,
                                                                 typeof (SDataPayload),
                                                                 typeof (ExpandableObjectConverter));
                        }
                        else if (pair.Value is SDataPayloadCollection)
                        {
                            prop = new VirtualPropertyDescriptor(pair.Key,
                                                                 typeof (SDataPayloadCollection),
                                                                 typeof (ExpandablePayloadCollectionConverter));
                        }
                        else
                        {
                            prop = new VirtualPropertyDescriptor(pair.Key, typeof (string), null);
                        }

                        properties.Add(prop);
                    }
                }

                return new PropertyDescriptorCollection(properties.ToArray());
            }
Esempio n. 3
0
            public override bool Equals(object obj)
            {
                VirtualPropertyDescriptor other = obj as VirtualPropertyDescriptor;

                return(other != null && other._pi.Equals(_pi));
            }