lundi 25 avril 2022

Using reflection on ProcessStartInfo to call it in a dynamic way

I have the following code in a jsp, which calls in a dynamic way a method:

            ....
            List<String> tsil = new ArrayList<String>();
            .....
            Class kj = Class.forName("test");
            Process w = (Process) kj.getMethod("method1").invoke(kj.getDeclaredConstructors()[0].newInstance(tsil));
            ....

I would like to do the same thing but in C# for an aspx page:

    .....
    ProcessStartInfo THf = new ProcessStartInfo();
    THf.FileName = "filename";
    THf.Arguments = "param1 "+arg;
    THf.RedirectStandardOutput = true;
    THf.RedirectStandardError = true;

    THf.UseShellExecute = false;
    Process Y = Process.Start(THf);
    ....

How can I do it, if is it possible?

If it is not possible, is there something similar to it?





Aucun commentaire:

Enregistrer un commentaire