Alex Rivera | Logout

How do I find all properties of type DateTime in an class?

Asked 2010-03-22T08:01:11.840
28

I need to adjust the datetime of a bunch of objects.

I'd like to loop through the properties of the class and if the type is dateTime adjust accordingly.

Is there any kind of 'describe type' built in goodness I can use?

Edit
Report

1 Answer

1

look up reflection but basicly you do this

obj.GetType().GetProperties(..Instance | ..Public) and you got a list of the properties defined.. check the value type of the property and compare it to typeof(DateTime).

answered 2010-03-22T08:04:30.197

Your Answer