Hi!

We defined an attribute that can be applied to a type multiple times
(AllowMultiple = true). A type can have numerous instances of that attribute
that it may have inherited from its base classes.
Problem: If we have an instance of that attribute how can we find out which
class originally was signed with that specific instance.
E.g:

[AttributeUsage( AttributeTargets.Class, AllowMultiple = true )]
public class MyAttribute : Attribute
{
public MyAttribute( int intVal ) { ... }
}

[My(1)]
class Base
{
}

[My(2)]
class Child : Base
{
}

So Child is signed with My(1) and also My(2). If we have My(1), how can we
get the type that was signed with My(1), in this case Base.

TIA,

Markus


--
##########################################
Please do not send replies to msdngroups@syska.de.
Mails sent to that adress will be deleted without being read.

Re: Reflection: Get type signed with attribute by Mattias

Mattias
Tue Aug 12 04:39:45 CDT 2003

Markus,

>Problem: If we have an instance of that attribute how can we find out which
>class originally was signed with that specific instance.

You can't, unless you pass that information to the attribute instance
yourself.



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.