开发者

Alternative to TypeDescriptor in Silverlight 3?

开发者 https://www.devze.com 2022-12-20 19:53 出处:网络
Am using this code in WPF to check for properties. if (TypeDescriptor.GetProperties(this)[propertyName] == null)

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消