I have four assemblies, ModuleStatic, Loader and ModuleA and ModuleB, all of them are DLL besides Loader which is an executable.
In DLL ModuleStatic:
public class ModuleStatic {
public static string Foo { get; set; } = "Foo";
}
In Loader, ModuleA and ModuleB will be loaded through Assembly.Load and AppDomain, to domA and domB respectively. If ModuleA modified the ModuleStatic.Foo variable, will the ModuleB, which is in domB, receive the modification?
No, variables, static or not, will not be shared across AppDomains. Instances live within their own AppDomain, they won't cross unless you do some work for it, for example by making it MarshalByRefObject and copy the static 'instance' around.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With