Determine units of a property in .Net
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am selecting items and grabbing their DBObjects, and then reflecting on those objects to inspect properties of the object. For example, I might have a DBObject that is actually of type Pipe, Duct, DuctFitting, Line, etc, so I am using TypeDescriptor reflection to handle various cases in as abstract a way as possible.
My first question is this: Is this the smartest way to grab all of the attributes of a give object? Is there another call I can make the retrieve all of the attributes for a Pipe and a Line (to very different types of objects).
Second, when I see a property named Length and it is a double I know it has to be a length and that I can use the units from the drawing. Is there a way to programatically discover this other than the name of the property and its type (double)? In other words is there some metadata I could retrieve about any given property against which I am reflecting, or is there a smarter way to get these attributes which might provided said metadata?