• Autofac 小试


    ContainerBuilder builder = new ContainerBuilder();
                ////builder.RegisterType<GetTest>().As<IBufrTest>();
                //builder.RegisterType<GetTest>().AsImplementedInterfaces();
                //builder.RegisterType<gettest2>().As<IBufrTest>();
                string dllFIle = System.IO.Directory.GetCurrentDirectory() + "\DemoBufr.dll";
                builder.RegisterAssemblyTypes(Assembly.LoadFile(dllFIle)).AsImplementedInterfaces();
                IContainer resorlver = builder.Build();
                var test = resorlver.Resolve<IEnumerable<IBufrTest>>();
                StringBuilder sbtext = new StringBuilder();
                foreach (var item in test)
                {
                    sbtext.Append(item.getstring()).Append("
    ");
                }
                string ttxt = sbtext.ToString();
                Console.WriteLine(ttxt);
                Console.ReadKey();
  • 相关阅读:
    World Cup
    Eva's Problem
    Number-guessing Game
    WisKey的眼神
    Vowel Counting
    The 3n + 1 problem
    超级楼梯
    母牛的故事
    素数回文
    画8
  • 原文地址:https://www.cnblogs.com/lierjie/p/11973883.html
Copyright © 2020-2023  润新知