Bonsoir,
Quels droles d'idées, pourquoi ne pas utiliser un Dictionary<String, String> plutot qu'une "liste" de variable ??? ce serait tellement plus simple, performant, securisant (Reflection ne peux pas être utilisé si l'on n'est pas en full trust CAS)
Bref :
Type
t = typeof(Foo);
String fieldName = (from field in t.GetFields(BindingFlags.Public | BindingFlags.Static)
where field.FieldType == typeof(String)
where field.GetValue(null) == "toto"
select (String)field.Name
).FirstOrDefault();Je te laisse traduire en VB, ca me fait des boutons ce langage ;-)
Cyril -
MVP ASP.net -
MCPD ASP.net & MCTS SQL - Consultant indépendant