Esempio n. 1
0
        internal static string[] Compose(string[] template, int offset, int count,
            IEnumerable<string> placeholders, Func<string, string> valueFactory)
        {
            var segment = new ArraySegment<string>(template, offset, count);
            var operation = new ArrayOperationWithValueFactory(placeholders, valueFactory, segment.Count);

            Parallel.ForEach(segment, operation.ParallelLoopBody);

            return operation.GetResult() as string[];
        }
Esempio n. 2
0
        internal static string[] Compose(ICollection<string> template,
            IEnumerable<string> placeholders, Func<string, string> valueFactory)
        {
            var operation = new ArrayOperationWithValueFactory(placeholders, valueFactory, template.Count);

            Parallel.ForEach(template, operation.ParallelLoopBody);

            return operation.GetResult() as string[];
        }