vendredi 10 juillet 2015

Get constructor(s) of an assembly with details

According to simulating the .Net assemblies I am trying to get constructor(s) of an assembly with parameters names and parameters data types. I use this code :

                SampleAssembly = Assembly.LoadFrom("");

              ConstructorInfo[] constructor = SampleAssembly.GetTypes()[0].GetConstructors();

                foreach (ConstructorInfo items in constructor)
                {
                    ParameterInfo[] Params = items.GetParameters();
                    foreach (ParameterInfo itema in Params)
                    {
                    System.Windows.Forms.MessageBox.Show(itema.ParameterType + " " + itema.Name);
                    }
                }   

But it seems that there is nothing in itema But I implement the same scenario on the Methods and works ! (Im sure that my assembly contains more than 2 constructors with diffrent parameters) .

So any suggestion to retrieve constructor(s) of an assembly with parameter(s)?!

Thanks in advance.





Aucun commentaire:

Enregistrer un commentaire