There is no such thing as "global variable" in .NET. Your object
FarmIdOld
you refer to is the instance (non-static!), private(!) member of a non-static(!) class
MultiOwners
. It cannot be even close the anything which could possible be described as "global". You have as many instanced of this object as the instances of the class
MultiOwners
. Therefore, the question, as formulated makes no sense at all. The problem is also not described.
However, I can explain how you can track all the modifications of this object, if you lost ends. Replace it with some explicitly backed property (that is, not auto-implemented):
public partial class MultiOwners : System.Web.UI.Page {
string FarmIdOld {
get { return farmIdOldInstanceBackingField; }
set {
farmIdOldInstanceBackingField = value;
}
}
string farmIdOldInstanceBackingField;
}
This will be your
refactoring, some change in code which is guaranteed to keep the same semantic as before the change.
But now, you can use the debugger and set a breakpoint (please see the comment in the code sample above "break point here"). Each time you get the execution stopped at this break point, you can look at the debug window "Call stack" and see where the call comes from. This will be enough to find ends.
Now, you may need to solve one more debugging problem. As your
FarmIdOld
is something opposite to "global" :-), you can have several instanced of it.
You can mark all instances of all objects during debugging as unique objects. For this purpose in the debug "Watch" or "Autos" window, you can add the object to watch, if it is not "Auto", and use context menu when this object is selected. Then click "
Make Object ID" menu items. From this moment, you can tell this object from other instances on next execution of the same line.
—SA