Ioc Unity_第1张图片




  
    
  

  
    
      
        
      
    
  
  


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity.Configuration;
using Microsoft.Practices.Unity;
using System.Configuration;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            IUnityContainer container=new UnityContainer();
            UnityConfigurationSection unity = (UnityConfigurationSection) ConfigurationManager.GetSection("unity");

            unity.Configure(container);

            Console.WriteLine(container.Resolve().aa());

            Console.ReadKey();

        }
    }
}