Displaying Fields (and/instead of Properties) in a PropertyGrid

Posted by Jenk on Stack Overflow See other posts from Stack Overflow or by Jenk
Published on 2010-04-01T13:27:40Z Indexed on 2010/04/01 13:33 UTC
Read the original article Hit count: 236

Filed under:
|

I'd like to use a PropertyGrid to manipulate the data on some objects, however these objects don't have properties, they have fields. Thus a property grid doesn't display them (high five MS!)

Before anyone posts "just use properties": I can't at the moment.. these objects are DTOs and are used to send data to a VB6 Interop dll, thus all the parameters for the method calls are "ref" parameters (high five MS!), and C# won't compile if you use a property instead of a field or variable (high five MS!).

No, I am not going to create local variables for every property on any given object. There many, many fields, and many, many test cases that would need updating, as well as the production code it self, and this post/question may be the path of least resistance. :)

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms