I have a custom attribute, inside the constructor of my custom attribute I want to set the value of a property of my attribute to the type of the property my attribute was a
It's possible from .NET 4.5 using CallerMemberName:
[SomethingCustom]
public string MyProperty { get; set; }
Then your attribute:
[AttributeUsage(AttributeTargets.Property)]
public class SomethingCustomAttribute : Attribute
{
public StartupArgumentAttribute([CallerMemberName] string propName = null)
{
// propName = "MyProperty"
}
}