Your injected code can't access classes and objects defined in the main application.(to access classes defined in main application you can use reflection in the injected code again but the objects are inaccessible.)
But you can simply send data to injected code as a parameter:
using System;
namespace RuntimeCode {
public static class Program {
public static void StartPoint(object obj) {
Console.WriteLine("Hello, world!");
}
}
}
Then invoke StartPoint
method by sending obj
object that contains the data it needs.
you can use any type of object you need. But it should be recognized by injected code.