Exemplo n.º 1
0
        protected override TParseResult ParseLine(string line)
        {
            IPostCodeEntity entity = new PostCodeEntity();

            var splitLine = line.Split(new[] { Delimiter }, StringSplitOptions.None);

            if (splitLine[0].Length > 0)
            {
                entity.PostCode = splitLine[0];
                entity.Address  = splitLine[1];
                entity.Place    = splitLine[2];
                entity.Province = splitLine[3];
                entity.County   = splitLine[4].Trim();
            }

            return((TParseResult)entity);
        }
Exemplo n.º 2
0
        public void TestMethod1()
        {
            //var results = from type in Toci.EntityAnalyzer.
            //              where typeof(I).IsAssignableFrom(type)
            //              select type;


            PostCodeEntity look = new PostCodeEntity();


            var method = typeof(PostCodeEntity).GetMethod("RemoveThis");
            //method.MakeGenericMethod()

            var types = Assembly.GetAssembly(typeof(PostCodeEntity)).GetTypes().Where(m => typeof(IParseResult).IsAssignableFrom(m));

            foreach (Type type in types)
            {
                MethodInfo showThisMethod         = look.GetType().GetMethod("RemoveThis", BindingFlags.Instance | BindingFlags.NonPublic);
                var        tujesttoczegonamtrzeba = showThisMethod.MakeGenericMethod(type, type);

                tujesttoczegonamtrzeba.Invoke(look, new object [] { 8, "Erley" });

                IParseResult test234 = (IParseResult)Activator.CreateInstance(type);

                test234.RemoveThis();

                List <string> fff = new List <string>();

                //fff.AsParallel().WithDegreeOfParallelism(8).ForAll();

                //look.ShowThis <type> ();
            }

            var test = Assembly.Load("Toci.EntityAnalyzer").GetTypes().Where(m => typeof(IParseResult).IsAssignableFrom(m));

            //var erleytest = Assembly.LoadFile()

            IEnumerable <Type> mytypes =
                System.Reflection.Assembly.GetExecutingAssembly()
                .GetTypes()
                .Where(mytype => mytype.GetInterfaces().Contains(typeof(IParseResult)));
        }