I have a method I'm writing that uses reflection to list a class's static properties, but I'm only interested in those that are of a particular type (in my case, the property must be of a type derived from DataTable). What I would like is something like the if() statement in the following (which presently always returns true):
PropertyInfo[] properties = ( typeof(MyType) ).GetProperties( BindingFlags.Public
| BindingFlags.Static );
foreach( PropertyInfo propertyInfo in properties ) {
if( !( propertyInfo.PropertyType is DataTable ) )
continue;
//business code here
}
Thanks, I'm stumped.