I know that if you use a fixed variable, its value is shared among all users.
stable string testValue = ""; Protected Zero Certain Methods (Object Sender, Event AGS E) {testValue = TextBox1.Text; String value = TestClass.returnString (TextBox1.Text); In this case, if 1 user goes to a website and places a value in the text box, then the string testValue overwrites with another value If any other user enters something in the text box (I think?) I now have this class:
public class test class {public stable String return string (string msg) {return msg; }} My question is now, if I use a static method, then what is the value of the shared method for all users also? Or is it always a "unique" value for the user?
Say that this method is called 5 times by 5 different users, whether this static method will return the value entered by a specific user, or it is possible that 1 user Get a value that another user has entered?
Your question was:
My question is now, if I Using a static method, is the return value of the method shared to all users? Or does this user always have a "unique" value?
And the answer is, it depends. Using your example:
public class test class {public static string return string (string msg) {return msg; }} In this case, 5 different users (most likely) will pass in 5 different strings for the static method. So they will get five differents wire back. So for this matter:
string value = test class.ratestring (text box 1 text); If every user was back in their text box, the code on the other hand was:
string value = TestClass.returnString (testValue); They will all get back which was in a fixed string at the time of return.
The rule should be kept in mind like this:
- If the method uses static member variables, different users will affect each other's results The danger of the fact is that the truth of whether the law is static or not is redeemed.
- If the method uses only call parameters and local variables, and the call parameters themselves point to the status member variable, different users will not call from each other affect.
Comments
Post a Comment