Slavcho wrote on Nov 30
th, 2006 at 7:03pm:
Yeah, but take for example the RichTextBox control. We had the following problem recently - RichTextBox defines Text, Lines and Rtf properties. Rtf contains the formatting tags, and Text and Lines contain just the plain text without any formatting.
So FlowChart.NET saves Rtf with formatting, then it saves the other 2 plain-text properties. When loading, Rtf is set first, and then Text. However assigning to Text has a side effect of losing all formatting, so what you load from the file is not the same as what you save
So we have added to the 4.2.2 version some special code to filter out the Text and Lines properties of RichText object. That's just an example that one never knows what will happen when using reflection.
g.
I see, however that is not really an issue with reflection, it's a behavior in the RTF control that was poorly defined and documented (not a big surprise given it's owner).
All I want to know is if the properties themselves are restricted to those types, they will always be properly set. How my UserControl handles these properties being set (and in what order) is completely up to me and something totaly in my control.
But I get your point. If you use a 3rd party control, this might be completely out of your hands.
Perhaps you'd be good to provide a persistencepolicy class, which defines in which order properties should be set? Could probably be very easy to implement. That would free you from having to write special cases in your code, since you can never account for all the 3rd party controls out there, nor should that code really be in your library to begin with.
Just my 2 cents.