Exemplo n.º 1
0
        private IList CreateItemsSource()
        {
            IList list = null;

            if (ItemsSourceType != null)
            {
                ConstructorInfo constructor = ItemsSourceType.GetConstructor(Type.EmptyTypes);
                list = (IList)constructor.Invoke(null);
            }

            return(list);
        }
        private IEnumerable CreateItemsSource()
        {
            IEnumerable collection = null;

            if (ItemsSourceType != null)
            {
                var constructor = ItemsSourceType.GetConstructor(Type.EmptyTypes);
                if (constructor != null)
                {
                    collection = (IEnumerable)constructor.Invoke(null);
                }
            }

            return(collection);
        }
Exemplo n.º 3
0
        private IList CreateItemsSource()
        {
            IList list = null;

            if (ItemsSourceType != null && !ItemsSourceType.IsArray)
            {
                ConstructorInfo constructor = ItemsSourceType.GetConstructor(Type.EmptyTypes);
                list = (IList)constructor.Invoke(null);
            }
            else if (ItemsSourceType != null)
            {
                list = new ArrayList();
            }

            return(list);
        }
Exemplo n.º 4
0
        private IEnumerable CreateItemsSource()
        {
            IEnumerable collection = null;

            if (ItemsSourceType != null)
            {
                var constructor = ItemsSourceType.GetConstructor(Type.EmptyTypes);
                if (constructor != null)
                {
                    collection = ( IEnumerable )constructor.Invoke(null);
                }
                else if (ItemsSourceType.IsArray)
                {
                    collection = Array.CreateInstance(ItemsSourceType.GetElementType(), Items.Count);
                }
            }

            return(collection);
        }