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 6339005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:33:44+00:00 2026-05-24T19:33:44+00:00

Hi guys I have one question, If I have a sequence of methods for

  • 0

Hi guys I have one question,

If I have a sequence of methods for example:

Main()
{
  Method1();
}

Method1()
{
  Method2();
}

Method2()
{
  Method3();
}

Method3()
{
  ObtainsUserPermission(httpContext.Current.User.Name);
}

How is the best way to do it, using the parammeter “httpContext.Current.User.Name” in the last Method3, or passing by parammeter in each method? Like this:

Main()
{
  Method1(httpContext.Current.User.Name);
}

Method1(string name)
{
  Method2(name);
}

Method2(string name)
{
  Method3(name);
}

Method3(string name)
{
  ObtainsUserPermission(name);
}

thank you for all.

  • 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-24T19:33:45+00:00Added an answer on May 24, 2026 at 7:33 pm

    This smells like magic parameters.

    A good rule of thumb is – if you wish your execution of method3() to depend on the name, pass the name as a parameter. In general, you shouldn’t use globals inside functions. It can become complicated to debug and maintain. An exception is members of a class, in which case your members are visible inside the methods and there is no need to pass them as parameters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys I have one more question lol. I am using a script that
Hey guys, one more quick question for any experts out there. I have a
Hi guys I just have one quick question: what happens when an insert statement
Heyy guys, i have one short question: What programming language/framework do you think is
guys i have a one question relates to point structure declaration,when i was reading
right guys im having trouble with one. what i want to do is have
TGIF guys, but I am still stuck on one of my projects. I have
Sorry guys, didn't know how to word this one. Still learning jquery and have
Hello guys I have a confusing question! If I'm using WCF to create a
Hello guys I have a specific question about the AND clause in SQL. The

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.