En mi carga de página, ¿llamo al ReturnStuff()
una o tres veces? Si lo llamo tres veces, ¿hay alguna manera más eficiente de hacerlo?¿Estoy usando listas correctamente?
protected void Page_Load(object sender, EventArgs e)
{
string thing1 = ReturnStuff(username,password)[0];
string thing2 = ReturnStuff(username, password)[1];
string thing3 = ReturnStuff(username, password)[2];
}
public static List<string> ReturnStuff(string foo, string bar)
{
// Create a list to contain the attributes
List<string> Stuff = new List<string>();
// Some process that determines strings values based on supplied parameters
Stuff.Add(fn);
Stuff.Add(ln);
Stuff.Add(em);
return Stuff;
}
¿Estás preguntando si estás llamando al método tres veces o no? –
Sí, eso y cómo hacer esto de manera más eficiente. – mmcglynn