public static IReadOnlyList <T> WrapAsIReadOnlyList <T>(this IEnumerable <T> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (source is T[] array)
            {
#if LESSTHAN_NET45
                return(new ReadOnlyCollectionEx <T>(array));
#else
                return(ArrayEx.AsReadOnly(array));
#endif
            }
            if (source is ListEx <T> listEx)
            {
                return(listEx.AsReadOnly());
            }
#if GREATERTHAN_NET45 || TARGETS_NETCORE || TARGETS_NETSTANDARD
            if (source is List <T> list)
            {
                return(list.AsReadOnly());
            }
#endif
            if (source is IReadOnlyList <T> result)
            {
                return(result);
            }
            return(EnumerationList <T> .Create(source));
        }
        public static IReadOnlyCollection <T> AsIReadOnlyCollection <T>(this IEnumerable <T>?source)
        {
            if (source == null)
            {
                return(EmptyCollection <T> .Instance);
            }
            if (source is T[] array)
            {
#if LESSTHAN_NET45
                return(new ReadOnlyCollectionEx <T>(array));
#else
                return(ArrayEx.AsReadOnly(array));
#endif
            }
            if (source is ListEx <T> listEx)
            {
                return(listEx.AsReadOnly());
            }
#if GREATERTHAN_NET45 || TARGETS_NETCORE || TARGETS_NETSTANDARD
            if (source is List <T> list)
            {
                return(list.AsReadOnly());
            }
#endif
            if (source is IReadOnlyCollection <T> result)
            {
                return(result);
            }
            return(EnumerationList <T> .Create(source));
        }