Tuesday, March 27, 2012

List object field values

Hi,

I'm not sure if this is possible, but what I'm trying to do is create a function within an object which returns a name-vale pair collection of the object's fields (not properties). Ideally this would be filtered to only display fields which are simple types (int, string etc) and not other user-defined objects.

Any help would be gratefully recieved

Cheers,
Al

I should add that I want the returned collection to include all fields, i.e. public, protected, private etc.

Cheers,
Al


Hi, Al

Why not try it and tell us what you do. I mean that's possible. If there is any other problem, you can tell us again.


Checkout this article...

http://msdn.microsoft.com/msdnmag/issues/05/04/NETMatters/default.aspx

I used it as a basis for a custom IDictionary implementation that could take any object and get/set properties and fields.

Brian

0 comments:

Post a Comment