-1

I made a C# project in visual studio 2010 according to post:

http://www.blackwasp.co.uk/RuntimeCompilation_1.aspx

I want read a txt file and Send Parameter to One Method then get Result. Now my question is that how to send an argument or parameter to Method in Runtime Compilation?

Raj Ranjhan
  • 3,869
  • 2
  • 19
  • 29
mehdi
  • 59
  • 4
  • 10

1 Answers1

1

http://www.blackwasp.co.uk/RuntimeCompilation_2.aspx has an example of invoking a method using reflection. What you want to do is Invoke the method, e.g. object result = myMethod.Invoke(null, myParam); and look at result.

Tim S.
  • 55,448
  • 7
  • 96
  • 122
  • thanks for answer. yes i want do like object result = myMethod.Invoke(null, myParam); but i cant input myParam. now how set myParam in Invoke because had Compile error (e.g. "Hello World!"). – mehdi Apr 30 '12 at 15:57
  • I'm not sure what you're asking. What is it you're doing that's giving you a compilation error? Are you giving the provider invalid code? – Tim S. May 02 '12 at 13:35