コード例 #1
0
        public DelimitedMultiEngineTests()
        {
            var factory = new DelimitedFileEngineFactory();
            var types   = new System.Collections.Generic.List <Type>()
            {
                typeof(Record1),
                typeof(Record2)
            };

            engine = factory.GetEngine(types.AsEnumerable <Type>(),
                                       s =>
            {
                if (String.IsNullOrEmpty(s) || s.Length < 1)
                {
                    return(null);
                }

                switch (s[0])
                {
                case 'S':
                    return(typeof(Record1));

                case 'D':
                    return(typeof(Record2));

                default:
                    return(null);
                }
            }
                                       );
        }
コード例 #2
0
 public static System.Collections.Generic.IEnumerable <T> Add <T>(this System.Collections.Generic.IEnumerable <T> source, params T[] toAdd)
 {
     System.Collections.Generic.List <T> list = new System.Collections.Generic.List <T>(source);
     list.AddRange(toAdd);
     return(list.AsEnumerable <T>());
 }