コード例 #1
0
        /// <summary>
        /// TResult is the same type as T1 (output collection is the same generic as input)
        /// </summary>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="files_in"></param>
        /// <param name="func"></param>
        private static List <TResult> ChangeContent <T1, T2, TResult>(ChangeContentArgs a, Func <T1, T2, TResult> func, List <T1> files_in, T2 t2)
        {
            List <TResult> result = new List <TResult>(files_in.Count);

            for (int i = 0; i < files_in.Count; i++)
            {
                // Fully generic - no strict string can't return the same collection
                result.Add(func.Invoke(files_in[i], t2));
            }

            CA.RemoveDefaultT <TResult>(result);
            return(result);
        }
コード例 #2
0
        private static void RemoveNullOrEmpty(ChangeContentArgs a, List <string> files_in)
        {
            if (a != null)
            {
                if (a.removeNull)
                {
                    CA.RemoveDefaultT <string>(files_in);
                }

                if (a.removeEmpty)
                {
                    CA.RemoveStringsEmpty2(files_in);
                }
            }
        }