shark,
In order to do this, you would have to use the compiler directly (there
are classes in the Microsoft.CSharp namespace to do this). You would feed
it the code, and then it would return the compiled code to you.
However, you might be better off trying to use IL, especially if you are
creating temporary pieces of code.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"shark" <ma**@poczta.onet.plwrote in message
news:f0**********@news.onet.pl...
Hi,
MethodBuilder.CreateMethodBody creates the body of the method using a
supplied byte array of Microsoft intermediate language (MSIL)
instructions.
Is there any way to create and compile method at runtime created from
byte[] of c# code?
i.e.
public int sum(int a, int b)
{
return a+b;
}
How to create such method ?
Thx