public void Execute() { try { var genericListInstance = _genericTypeCreator.CreateInstanceFor(typeof(List <>), _fieldInfo.FieldType.GenericTypeArguments); var command = new SetFieldCommand(_object, _collectionName, genericListInstance); command.Execute(); AddElementsTo(genericListInstance.GetType()); } catch (Exception ex) { throw new FluentBuilderException(string.Format("Failed setting collection \"{0}\" - Object \"{1}\"", _collectionName, _object.GetType()), ex); } }
public object GetDefaultValueFor(Type type) { return(_genericTypeCreator.CreateInstanceFor(typeof(List <>), type.GenericTypeArguments)); }