Bonjour,
Est il possible de faire un classe avec pour attributs un string et une méthode ?
En fait je veux faire un répertoire avec des tags et pour chaque tag une action.
Je comptais créer une classe:
puis :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 class TagAndAction { public string tag; public Action act; }
Mais sur cette dernière ligne j'ai une erreur "cannot explicitely convert void into System.Action.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 public TagAndAction TagAndAction1; public TagAndAction TagAndAction2; public TagAndAction TagAndAction3; ... TagAndAction1 = new TagAndAction; TagAndAction1.tag = "tag1"; TagAndAction2.act = Method1(); //Method1() est une méthode publi void Method1()...
Savez vous comment je peux faire ?
Merci !
Partager