|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Howto: Determine within a custom attribute, the type it has been declared on?I have a custom attribute that inherits from System.Attribute and itself is
declared with the AttributeUsage( AttributeTargets.Class ) attribute. Regarding this I have two questions. Can I further limit my attribute to only be applicable to types that are concrete and have a public default constructor? Can I, from within my attribute class determine the System.Type of the class to which it has been applied? --Ken Hello Kenneth,
>Can I further limit my attribute to only be applicable to types that are I don't think either of these is possible.>concrete and have a public default constructor? >Can I, from within my attribute class determine the System.Type of the >class to which it has been applied? Oliver Sturm "Kenneth Baltrinic" <no.direct.repl***@nowhere.xyz> wrote in message An attribute can accept a Type parameter to its constructor, but the caller news:OzaOaS9ZHHA.4772@TK2MSFTNGP05.phx.gbl... >I have a custom attribute that inherits from System.Attribute and itself is >declared with the AttributeUsage( AttributeTargets.Class ) attribute. >Regarding this I have two questions. > > Can I further limit my attribute to only be applicable to types that are > concrete and have a public default constructor? > Can I, from within my attribute class determine the System.Type of the > class to which it has been applied? would have to manually specify the class it is being applied to. Show quote > > --Ken > |
|||||||||||||||||||||||