コード例 #1
0
        public object CreateContainer(Type containerType, IEnumerable <object> elements)
        {
            var container   = Activator.CreateInstance(containerType);
            var elementType = StructureFactory.GetElementType(containerType);

            foreach (var el in elements)
            {
                ReflectionUtils.CollectionAdd(elementType, container, el);
            }

            return(container);
        }