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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:10:11+00:00 2026-05-24T03:10:11+00:00

The variable asynchExecutions does get changed, but it doesn’t change the reference variable. Simple

  • 0

The variable asynchExecutions does get changed, but it doesn’t change the reference variable.
Simple question, why isn’t this ref parameter in this constructor changing the original value passed in?

public partial class ThreadForm : Form
{
    int asynchExecutions1 = 1;
    public ThreadForm(out int asynchExecutions)
    {
        asynchExecutions = this.asynchExecutions1;
        InitializeComponent();
    }

    private void start_Button_Click(object sender, EventArgs e)
    {
        int.TryParse(asynchExecution_txtbx.Text, out asynchExecutions1);

        this.Dispose();
    }

}
  • 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-24T03:10:12+00:00Added an answer on May 24, 2026 at 3:10 am

    How do you know that asynchExecutions is not changing? Can you show your testcase code that proves this?

    It appears that on constructing ThreadForm asynchExecutions will be set to 1. However when you call start_Button_Click, you set asyncExecutions1 to the value in the text box.

    This WILL NOT set asyncExecutions to the value in the text box, because these are value types. You are not setting a pointer in the constructor.

    It seems to me that you are confused between the behavior of value types versus reference types.

    If you need to share state between two components, consider using a static state container, or passing in a shared state container to the constructor of ThreadForm. For example:

     public class StateContainer
     {
         public int AsyncExecutions { get; set;}
     }
    
    public class ThreadForm : Form
    {
         private StateContainer _state;
    
         public ThreadForm (StateContainer state)
         {
              _state = state;
              _state.AsyncExecutions = 1;
         }
    
         private void start_Button_Click(object sender, EventArgs e)
         {
              Int.TryParse(TextBox.Text, out _state.AsyncExecutions);
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Variable is used in 1 task only, but the question is: can it be
$alltext variable contents this code inside: <li>sometext</li><li>sometext</li> <li>sometext</li><li>sometext</li> How do I get each <li>...</li>
My variable is Global, but she doesn't display the same result : function checkLiveRdv(salle,
My variable $var has the form 'abc.de'. What does this substr exactly do in
$image variable gives this code (when echo is used): <img src=/image.png width=100 height=147 alt=
double variable = Convert.ToDouble(5/100); Will return 0.0 but i expected 0.05 What can /
I have a variable that looks likes this, $rslt['expected_salary_level'] This returns a string similar
The variable strCSSClass often has a value but sometimes is empty. I do not
I have a session variable that I set like this: <?php $token = md5(uniqid(rand(),
Before variable-length arrays were supported, I would dynamically allocate them like this: int foo(size_t

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.