我已经创建了自己的属性来装饰我的对象。.Net:如何使用TypeDescriptor.GetProperties获取自定义属性?
[AttributeUsage(AttributeTargets.All)]
public class MyCustomAttribute : System.Attribute { }
当我尝试使用TypeDescriptor.GetProperties传入我的自定义属性不返回即使型装饰与属性什么。
var props = TypeDescriptor.GetProperties(
type,
new[] { new Attributes.FlatLoopValueInjection()});
我怎么TypeDescriptor.GetProperties承认我的自定义类型?
为什么downvote?这不是回答这个问题吗? – Jason
不是我的,但我认为他正试图访问属性上的属性,而不是自己的类。 –