Boo.Lang.Builtins.array C# (CSharp) Метод

array() публичный статический Метод

public static array ( Type elementType, ICollection collection ) : Array
elementType System.Type
collection ICollection
Результат System.Array
        public static Array array(Type elementType, ICollection collection)
        {
            if (null == collection)
            {
                throw new ArgumentNullException("collection");
            }
            if (null == elementType)
            {
                throw new ArgumentNullException("elementType");
            }

            Array array = Array.CreateInstance(elementType, collection.Count);
            if (RuntimeServices.IsPromotableNumeric(Type.GetTypeCode(elementType)))
            {
                int i=0;
                foreach (object item in collection)
                {
                    object value = RuntimeServices.CheckNumericPromotion(item).ToType(elementType, null);
                    array.SetValue(value, i);
                    ++i;
                }
            }
            else
            {
                collection.CopyTo(array, 0);
            }
            return array;
        }

Same methods

Builtins::array ( Type elementType, IEnumerable enumerable ) : Array
Builtins::array ( Type elementType, int length ) : Array
Builtins::array ( IEnumerable enumerable ) : object[]