Example #1
0
        private object CreateByConstructor(Type t, ConstructorInfo info)
        {
            object[]    tmp            = new object[info.GetParameters().Length];
            int         i              = 0;
            List <Type> elementCreated = new List <Type>();

            foreach (ParameterInfo parameterInfo in info.GetParameters())
            {
                tmp[i] = _fieldValueGenerator.generateValue(parameterInfo.ParameterType, elementCreated);
                i++;
            }
            _fieldValueGenerator.clearCycleControlList(elementCreated);
            return(info.Invoke(tmp));
        }
Example #2
0
        public object generate(Type t)
        {
            object newObject = Activator.CreateInstance(typeof(List <>).MakeGenericType(t));

            ((IList)newObject).Add(_fieldValueGenerator.generateValue(t, new List <Type>()));
            return(newObject);
        }