Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7681317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:18:53+00:00 2026-05-31T18:18:53+00:00

In my page load, am I calling ReturnStuff() once or three times? If I

  • 0

In my page load, am I calling ReturnStuff() once or three times?
If I am calling it three times, is there a more efficient way to do this?

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;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:18:54+00:00Added an answer on May 31, 2026 at 6:18 pm

    You’re calling it three times. Here is a more efficient way:

    protected void Page_Load(object sender, EventArgs e)
    {
        var stuff = ReturnStuff(username,password);
        string thing1 = stuff[0];
        string thing2 = stuff[1];
        string thing3 = stuff[2];
    }
    

    But more than that, if you have a first name, last name, and e-mail, I would write a function that returns an object composing a first name, last name, and e-mail:

    public class User
    {
         public string LastName {get;set;}
         public string FirstName {get;set;}
         public string EMail {get;set;}
    }
    
    public static User GetUser(string username, string password)
    { 
        // Some process that determines strings values based on supplied parameters
    
        return new User() {FirstName=fn, LastName=ln, EMail=em};
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
        var user = GetUser(username,password);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Page_Load Calls more than once (4 times in my case) in FireFox but in
Then: protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CheckBoxList1.Items.Add(new ListItem(item1)); CheckBoxList1.Items.Add(new
I am calling the following jQuery code on page load to test the concept
I calling multiple function on page load in my asp.net web application. All function
I need a way of calling a web page from inside my .net appliction.
I'm calling a page via WebForm_DoCallback javascript function. On server, in Page_Load I'm trying
Is Page.Load the earliest point in the Page.Load life cycle to add Response.AppendHeader?
I want on page load for the class of a li tag to be
On my page in the Page_Load event I add a collection of strings to
I would like to detect when a page load request give to a UIWebView

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.