Hello. I have the following code:
public class AppDomainArgs : MarshalByRefObject {
public string myString;
}
static AppDomainArgs ada = new AppDomainArgs() { myString = "abc" };
static void Main(string[] args) {
AppDomain domain = AppDomain.CreateDomain("Domain666");
domain.DoCallBack(MyNewAppDomainMethod);
Console.WriteLine(ada.myString);
Console.ReadKey();
AppDomain.Unload(domain);
}
static void MyNewAppDomainMethod() {
ada.myString = "working!";
}
I thought make this would make my ada.myString have "working!" on the main appdomain, but it doesn't. I thought that by inhering from MarshalByRefObject any changes made on the 2nd appdomain would reflect also in the original one(I thought this would be just a proxy to the real object on the main appdomain!)?
Thanks