views:

45

answers:

3

I can't find any idea of the way to use this attribute?

A: 

If you don't know what it does, why do you need to use it? Do you have any code that is using it currently that you could post as an example?

It sounds like it allows you to define that a property editor for your property can be reused without restarting. I am not particularly sure why this would be useful.

Andrew Hare
A: 

MSDN indicates it is indeed to indicate that a property editor can be reused without needing to recreate each time.

This is a performance win, especially if your editor needs to do significant work on start up which can be avoided. Unless you are actually having performance issues then I wouldn't worry about it.

ShuggyCoUk
+1  A: 

imagine you have scenario like this:

class Complex
{
   public OtherComplex1 Property1 { get; set; }
   public OtherComplex2 Property2 { get; set; }
   public OtherComplex2 Property3 { get; set; }
   .....
   public OtherComplexN PropertyN { get; set; }

}

each of your properties has its own type designer, which displays some properties, etc.

say, you have two different instances of the Complex class + instance of some other arbitrary class.

now, when you toggle between your objects like this - complex instance 1 -> other -> complex instance 2 - everything will work fine, but if you do something like this:

complex instance 1 -> complex instance 2, you'd notice that properties are not beeing refreshed.

that is default behavior of property grid, which tries to optimize number of data refresh operations. unless you want to bake a lot of logic in order to keep your designers updated, i'd suggest marking your complexTypes with editor reuse attribute set to false - in this case, whenever selection changes to a different instance, property grid would still refresh your designers.

Greg