Podczas ładowania strony dzwonię raz czy trzy razy pod numer ReturnStuff()
? Jeśli dzwonię to trzy razy, czy istnieje skuteczniejszy sposób na zrobienie tego?Czy używam poprawnie list?
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;
}
Czy pytasz, czy wywołujesz tę metodę trzy razy, czy nie? –
Tak, to i jak to zrobić bardziej efektywnie. – mmcglynn