restricting the property type of a custom attribute

Posted by Guy on Stack Overflow See other posts from Stack Overflow or by Guy
Published on 2010-04-25T13:01:03Z Indexed on 2010/04/25 13:03 UTC
Read the original article Hit count: 165

Filed under:
|

Does anyone knows if it is possible to define/declare on your own custom attribute a restriction to the field type it may apply on? There are a flags that do restrict the usage of the attribute:

[AttributeUsage(
 AttributeTargets.Property,
 AllowMultiple = false)]

Im looking for something like:

UseOnlyOnType = typeof(string)

Any ideas?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about attributes