Здравствуйте, LWhisper, Вы писали:
using System;
using System.Runtime.Serialization;
namespace ConsoleApplication1
{
class A
{
public A(string param)
{
Console.WriteLine(param);
}
}
class Program
{
static void Main(string[] args)
{
IntPtr ctor = typeof(A).GetConstructor(new Type[] { typeof(String) }).MethodHandle.GetFunctionPointer();
var actionCtor = typeof(Action<Object, String>).GetConstructor(new Type[] { typeof(Object), typeof(IntPtr) });
var ctorDelegate = (Action<Object, String>)actionCtor.Invoke(new Object[] { null, ctor });
var a = (A)FormatterServices.GetUninitializedObject(typeof(A));
ctorDelegate(a, "Hello world!");
}
}
}