Re: InheritedPropertyDescriptor vs. ReflectedPropertyDescriptor

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Notre,

This is something we ran into just few short weeks ago while converting our
application to .NET 2.0. We also have a custom serializer, which recursively
serializes root design component with all of its sub-components. The
workaround was to check for root designer and process it slightly
differently. Here's a pseudo code snippet:

PropertyDescriptorCollection properties;
if (comp is <RootDesigner>)
// New for .NET 2.0 implementation
properties = TypeDescriptor.GetProperties(comp.GetType());
else
properties = TypeDescriptor.GetProperties(comp);
WriteProperties(properties, ...);

HTH.
--
Sergey Mishkovskiy
http://www.usysware.com/dpack/ - free VS add-ons
http://www.usysware.com/blog/


"Notre Poubelle" <notre_poubelle@xxxxxxxxxxxxx> wrote in message
news:B5A0DB4B-545B-4AE3-8C13-E87512B5F390@xxxxxxxxxxxxxxxx
Hello,

I wonder if anyone can explain the difference between
InheritedPropertyDescriptor vs. ReflectedPropertyDescriptor classes? I'm
writing my own designer based on the .NET design time framework. I've got
a
custom design surface and am performing custom serialization with my own
designer loader.

Most everything works properly except in some cases where serialization is
concerned, some properties of controls do not get serialized. I call the
property descriptor's ShouldSerializeValue method to help decide whether a
control property should be serialized. In some cases, this method returns
True and in other cases False, when I would not expect it to return False.
I've read the description of PropertyDescriptor.ShouldSerializeValue and I
think I understand the rules that shoud be applied.

I get a list of properties by calling
TypeDescritpor.GetPRoperties(<object>,false). I've noticed in some cases
my
properties are of type InheritedPropertyDescriptor while in other cases,
they
are of type ReflectedPropertyDescriptor. It is when the properties are of
type InheritedPropertyDescriptor that the call to ShouldSerializeValue
returns False when I don't expect it to. Why do I sometimes get
InheritedPropertyDescriptor and other times get
ReflectedPropertyDescriptor?
The rules seem to be different between the two classes...

Thanks,
Notre



.



Relevant Pages

  • Re: Collection of Collection control @ DESIGN TIME
    ... // Initialize in a common function and call that function in each constructor. ... Serializable Attribute is not a design time attibute.. ... Here the serialization is designtime Serialization. ... Public Overloads Overrides Function CanConvertToAs Boolean ...
    (microsoft.public.dotnet.framework.windowsforms.designtime)
  • Re: Collection of Collection control @ DESIGN TIME
    ... // Initialize in a common function and call that function in each constructor. ... Here the serialization is designtime Serialization. ... Public Overloads Overrides Function CanConvertToAs Boolean ... but I wanted to include some Rich Design Time ...
    (microsoft.public.dotnet.framework.windowsforms.designtime)
  • Re: Design is intent.
    ... I recognize the notion of a "standard we use to judge the code". ... or a Java class named "foo_" are bad design, ... That doesn't seem to be at all on the same level as "all persistence ... will be based on object serialization, ...
    (comp.object)
  • Re: Design is intent.
    ... Would you say that people use the term "design" when they talk about writing ... > serialization" statement written somewhere in a document, ... is really a valid, logical exception, then yes (if you don't have a good ... that I can clearly see that all persistence is via serialization ...
    (comp.object)
  • Re: [PHP] A no brainer...
    ... The session ID will tell PHP what file to open in O. ... Or, if ALL your data is scalar and needs no serialization, it looks ... You *might* even be able to write a custom serializer for your ... specific data structures as a custom extension and significantly ...
    (php.general)