Access data in different application domains! (Reflection)

xiaoxiao2021-03-06  116

private void button1_Click (object sender, System.EventArgs e) {Evidence asEvidence = currentDomain.Evidence; currentDomain.Load ( "WindowsApplication2", asEvidence); Assembly [] assems = currentDomain.GetAssemblies ();

Console.WriteLine ( "List of assemblies loaded in current appdomain:"); foreach (Assembly assem in assems) {Type t = assem.GetType ( "WindowsApplication2.Form1"); if (t = null!) {FieldInfo [] fs = T.Getfields (); Foreach (FieldInfo F I) {IF ("VAL" == f.name) {F.SetValue (Null, "Hello World!"); console.writeLine (F.GetValue (null) .Tostring ());}}}}}

Declaration in WindowsApplication2.from1

Public static string Val = "test";

转载请注明原文地址:https://www.9cbs.com/read-126480.html

New Post(0)