public class AddingService
{
private int _total = 0;
public void AddAmmount(int ammount)
_total += ammount;
}
public int Total
get { return _total; }
private static void Main(string[] args)
WindsorContainer container = new WindsorContainer(new XmlInterpreter());
AddingService sheepCounted = container.Resolve<AddingService>();
AddingService catsHerded = container.Resolve<AddingService>();
sheepCounted.AddAmmount(10);
sheepCounted.AddAmmount(50);
catsHerded.AddAmmount(3);
catsHerded.AddAmmount(12);
Console.WriteLine("You have counted {0} sheep and herded {1} angry cats", sheepCounted.Total,
catsHerded.Total);
Console.Read();
<configuration>
<configSections>
<section name="castle"
type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" />
</configSections>
<castle>
<components>
<component id="adding.service" type="IoC.Tutorials.Part6.AddingService, IoC.Tutorials.Part6" lifestyle="transient" />
</components>
</castle>
</configuration>
[Transient]