コード例 #1
0
ファイル: UtilitiesInternal.cs プロジェクト: QITIE/ADLSTool
        /// <summary>
        /// Applies the <paramref name="objectCreationFunc"/> to each item in <paramref name="items"/> and returns a threadsafe collection containing the results.
        /// </summary>
        /// <typeparam name="TIn">The type of the input collection.</typeparam>
        /// <typeparam name="TOut">The type of the output collection.</typeparam>
        /// <param name="items">The collection to convert.</param>
        /// <param name="objectCreationFunc">The function used to created each <typeparamref name="TOut"/> type object.</param>
        /// <returns>A threadsafe collection containing the results of the conversion, or null if <paramref name="items"/> was null.</returns>
        internal static ConcurrentChangeTrackedModifiableList <TOut> CollectionToThreadSafeCollectionIModifiable <TIn, TOut>(
            IEnumerable <TIn> items,
            Func <TIn, TOut> objectCreationFunc)
            where TIn : class
            where TOut : class, IPropertyMetadata
        {
            ConcurrentChangeTrackedModifiableList <TOut> result = UtilitiesInternal.ConvertCollection(
                items,
                objectCreationFunc,
                (convertedItemsEnumerable) => new ConcurrentChangeTrackedModifiableList <TOut>(convertedItemsEnumerable));

            return(result);
        }
コード例 #2
0
ファイル: UtilitiesInternal.cs プロジェクト: QITIE/ADLSTool
        /// <summary>
        /// Applies the <paramref name="objectCreationFunc"/> to each item in <paramref name="items"/> and returns a non-threadsafe collection containing the results.
        /// </summary>
        /// <typeparam name="TIn">The type of the input collection.</typeparam>
        /// <typeparam name="TOut">The type of the output collection.</typeparam>
        /// <param name="items">The collection to convert.</param>
        /// <param name="objectCreationFunc">The function used to created each <typeparamref name="TOut"/> type object.</param>
        /// <returns>A non-threadsafe collection containing the results of the conversion, or null if <paramref name="items"/> was null.</returns>
        internal static List <TOut> CollectionToNonThreadSafeCollection <TIn, TOut>(
            IEnumerable <TIn> items,
            Func <TIn, TOut> objectCreationFunc)
            where TIn : class
            where TOut : class
        {
            List <TOut> result = UtilitiesInternal.ConvertCollection(
                items,
                objectCreationFunc,
                (convertedItemsEnumerable) => new List <TOut>(convertedItemsEnumerable));

            return(result);
        }