I'm trying to make a generic method and I want to pass an attribute when call it. Is it possibile or it's possible only on declaration?
Code:
public Window()
{
//Is it possible do this?:
[CustomAttribute(typeof(Something))]
MyGenericMethod();
}
private void MyGenericMethod()
{
//do stuff...
//retrieve type from CustomAttribute
}
public class CustomAttribute : Attribute
{
public CustomAttribute(Type type)
{
}
}