On Thursday, November 3, 2022 at 1:05:17 PM UTC-4, C.D. Altenburg, Ph.D, wrote:
Say I have the string
public static string foo = "foo";
can I just do
foo = null;
in order to dereference that string?
That depends what you mean by dereference. If you want to clear the value, sure set to null like that would work. If you mean remove the variable from memory, static values are tied to the class, you'd have to unload the class.
It is still possible but not advisable to have a public static variable which is not final. It's better to make it private static and use accessor methods.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)