Am using this code in WPF to check for properties.
if (TypeDescriptor.GetProperties(this)[propertyName] == null)
{
//some c开发者_开发技巧ode here...
}
I want to use the same logic in Silverlight 3, but there is no TypeDescriptor. Anyone knows an alternate way to do it in Silverlight.
Any reason not to use Type.GetProperties
/ Type.GetProperty
?
PropertyInfo property = GetType().GetProperty(propertyName);
...
I know they're not quite equivalent, but if you're dealing with a "normal" property it may well be close enough.
精彩评论