vendredi 11 novembre 2016

How to properly get large list and if-statiment listing value without listing in main code

I'm wondering, if there is some useful way to avoid large listing inside the code, which contains more then 200 or more values or conditions for lists and statements:

Dictionary<int, string> list = new Dictionary<int, string>() 
                   { { 1, "a" }, { 2, "b" }, { 3, "c" }, { 4, "d" } ...};

and like this:

var list = new List<string> {"a", "b", "c", "d", ...};

and same about if-statement:

if (a == "b" && a == "c" && a == "d" ...)

what possibilities I have to write it shorter inside the code, except using text document.

I'm not sure about this question, what is useful in such cases. How can I call list for statement from added class to project for if-statement and get values from list. Or maybe some other, anyway need competent advice on this direction.

Aucun commentaire:

Enregistrer un commentaire