C# Get memberinfo für das benutzerdefinierte Attribut target

Gegeben ein benutzerdefiniertes Attribut, das möchte ich, um die Namen seiner Gegner:

public class Example
{
    [Woop] //////basically I want to get "Size" datamember name from the attribute
    public float Size;
}

public class Tester
{
    public static void Main()
    {
        Type type = typeof(Example);
        object[] attributes = type.GetCustomAttributes(typeof(WoopAttribute), false);

        foreach (var attribute in attributes)
        {
            //I have the attribute, but what is the name of it's target? (Example.Size)
            attribute.GetTargetName(); //??
        }
    }
}

Hoffe, es ist klar!

Schreibe einen Kommentar