dato l'esempio, come ..utilizzando attributi per i vincoli generici
public interface IInterface { }
public static void Insert<T>(this IList<T> list, IList<T> items) where T : IInterface
{
// ... logic
}
Questo funziona bene, ma mi chiedevo se è possibile utilizzare un attributo come un vincolo. Ad esempio ...
class InsertableAttribute : Attribute
public static void Insert<T>(this IList<T> list, IList<T> items) where T : [Insertable]
{
// ... logic
}
Ovviamente questa sintassi non funziona, o non vorrei postare la domanda. Ma sono curioso di sapere se è possibile o meno, e come farlo.
Vorrei * LOVE * se questo è stato implementato ... – tenfour