Can C# Attributes access the Target Class?

Posted by Heka on Stack Overflow See other posts from Stack Overflow or by Heka
Published on 2010-02-21T23:57:06Z Indexed on 2010/05/27 7:41 UTC
Read the original article Hit count: 150

Filed under:
|
|

I want to access the properties of a class from the attribute class by using reflection. Is it possible?

For example:

class MyAttribute : Attribute
{
    private void AccessTargetClass()
    {
        // Do some operations
    }
}

[MyAttribute]
class TargetClass
{
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about reflection