Skip to content
Aqla.RunSharp is a fork of RunSharp from Google Code with IKVM support
Branch: master
Clone or download
Latest commit 4ba4f51 May 30, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Nuget snk fixed May 30, 2016
RunSharp.Tests.Android amend May 28, 2016
RunSharp.Tests.IKVM
RunSharp.Tests.Silverlight fix for explicit interface implementation, added Android platform May 28, 2016
RunSharp.Tests.Standard fix for explicit interface implementation, added Android platform May 28, 2016
RunSharp.Tests.WP8 fix for explicit interface implementation, added Android platform May 28, 2016
RunSharp.TestsShared amend May 28, 2016
RunSharp resolved some warnings Mar 6, 2016
RunSharpAndroid fix for explicit interface implementation, added Android platform May 28, 2016
RunSharpIKVM resolved some warnings Mar 6, 2016
RunSharpShared snk fixed May 30, 2016
RunSharpSilverlight resolved some warnings Mar 6, 2016
RunSharpWP8 fix for explicit interface implementation, added Android platform May 28, 2016
lib nuget package improvements May 6, 2016
packages release 0.2 Oct 25, 2015
tools snk fixed May 30, 2016
.gitignore release 0.2 Oct 25, 2015
LICENSE ikvm license included, small improvements Jan 27, 2016
README.md fix for explicit interface implementation, added Android platform May 28, 2016
RunSharp.sln fix for explicit interface implementation, added Android platform May 28, 2016
all.build snk fixed May 30, 2016
buildpack.cmd added windows phone 8 support Jan 13, 2016

README.md

Aqla.RunSharp

RunSharp is a runtime IL generator based on Reflection.Emit and IKVM which allows you to emit IL in a way similar to writing normal C# code.

It's a layer above the standard .NET Reflection.Emit API, allowing to generate/compile dynamic code at runtime very quickly and efficiently (unlike using CodeDOM and invoking the C# compiler).

The IKVM version has also an ability to emit NET 2.0 and .NET 4.0 assemblies (while running on, for example, .NET 3.0).

It is a fork of RunSharp from Google Code: https://code.google.com/p/runsharp/

  • added IKVM support
  • examples converted to tests
  • added peverify checks
  • fixed multiple bugs

Example

A simple hello world example in C#

public class Test
{
   public static void Main(string[] args)
   {
      Console.WriteLine("Hello " + args[0]);
   }
}

can be dynamically generated using RunSharp as follows:

AssemblyGen ag = new AssemblyGen("Hello", new CompilerOptions() { OutputPath = "Hello.exe" });
TypeGen Test = ag.Public.Class("Test");
{
   CodeGen g = Test.Public.Static.Method(typeof(void), "Main", typeof(string[]));
   {
      ContextualOperand args = g.Param(0, "args");
      g.Invoke(typeof(Console), "WriteLine", "Hello " + args[0] + "!");
   }
}
ag.Save();

The above code should generate roughly the same assembly as if the first example was compiled using csc.

For more examples please see tests.

Platforms

  • .NET 2.0 and higher (also IKVM version available)
  • Windows Phone 8
  • Silverlight 5
  • Xamarin.Android
You can’t perform that action at this time.