Activator.CreateInstance can't find the constructor (MissingMethodException)

后端 未结 9 2293
一个人的身影
一个人的身影 2021-02-18 15:55

I have a class which has the following constructor

public DelayCompositeDesigner(DelayComposite CompositeObject)
{
    InitializeComponent();

    compositeObjec         


        
9条回答
  •  一个人的身影
    2021-02-18 16:47

    Though I hate printf-like debugging ...

    public static void foo(Type t, params object[] p)
    {
        System.Diagnostics.Debug.WriteLine("<---- foo");
        foreach(System.Reflection.ConstructorInfo ci in t.GetConstructors())
        {
            System.Diagnostics.Debug.WriteLine(t.FullName + ci.ToString());
        }
        foreach (object o in p)
        {
            System.Diagnostics.Debug.WriteLine("param:" + o.GetType().FullName);
        }
        System.Diagnostics.Debug.WriteLine("foo ---->");
    }
    // ...
    foo(designerAttribute.Designer, new DelayComposite(4));
    var designer = Activator.CreateInstance(designerAttribute.Designer, new DelayComposite(4));
    

    What does that print in the visual studio's output window?

提交回复
热议问题