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

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

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

            // future optimization, check EnumeratorItemType of enumerable
            // and get the fast path whenever possible
            List l = null;
            if (RuntimeServices.IsPromotableNumeric(Type.GetTypeCode(elementType)))
            {
                l = new List();
                foreach (object item in enumerable)
                {
                    object value = RuntimeServices.CheckNumericPromotion(item).ToType(elementType, null);
                    l.Add(value);
                }
            }
            else
            {
                l = new List(enumerable);
            }
            return l.ToArray(elementType);
        }

Same methods

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