public static Method ReverseEngineer(System.Reflection.ConstructorInfo _constructor) { Method constructor = new Method(); //decompile method body if (!_constructor.IsAbstract) { Mono.Cecil.AssemblyDefinition ass = Decompiler.LoadAssembly(_constructor.DeclaringType.Module.Assembly.Location); MethodDefinition md = ass.MainModule.GetType(_constructor.DeclaringType.FullName).Methods.Where(md2 => md2.Name == _constructor.Name).Select(md2 => md2).First(); constructor.MethodCode = Decompiler.GetSourceCode(md); } constructor.Type = constructor.ReturnType = ReverseEngineer(_constructor.DeclaringType); constructor.Name = constructor.Type.Name; constructor.IsStatic = _constructor.IsStatic; constructor.IsAbstract = _constructor.IsAbstract; constructor.IsVirtual = _constructor.IsVirtual; constructor.Access = _constructor.GetAccessModifier(); foreach (System.Reflection.ParameterInfo _param in _constructor.GetParameters()) { MethodArgument ma = new MethodArgument(); ma.Method = constructor; ma.Name = _param.Name; ma.Type = ReverseEngineer(_param.ParameterType); DataBase.Current.Set <MethodArgument>().Add(ma); } if (_constructor.IsGenericMethod || _constructor.IsGenericMethodDefinition || _constructor.ContainsGenericParameters) { foreach (System.Type _genericArg in _constructor.GetGenericArguments()) { MethodGenericArgument genericArg = new MethodGenericArgument(); genericArg.ArgumentType = ReverseEngineer(_genericArg); genericArg.Position = _genericArg.GenericParameterPosition; genericArg.AppliedTo = constructor; DataBase.Current.Set <MethodGenericArgument>().Add(genericArg); } } DataBase.Current.Set <Method>().Add(constructor); }