title: Castle Windsor (IOC) Basics
body: <p>I am new to Castle Windsor and am trying to grok the basics...</p>
  
  <p>I have the following code...</p>
  
  <pre><code>namespace WindowsBash.Models
  {
      public interface IShouter
      {
          string Display();
      }
  
      public class Shout : IShouter
      {
          private IMessage _message;
  
          public Shout(IMessage message)
          {
              _message = message;
          }        
  
          public string Display()
          {
              return _message.TheMessage();
          }
      }
  
      public interface IMessage
      {
          string TheMessage();
      }
  
      public class MessageHello : IMessage
      {
          public string TheMessage()
          {
              return "Hello";
          }
      }
  
      public class MessageBye : IMessage
      {
          public string TheMessage()
          {
              return "Bye";
          }
      }
  }
  </code></pre>
  
  <p>I then have the following method to try and test what Windsor is doing....</p>
  
  <pre><code>private void TestIOC()
  {
      var container = new WindsorContainer();
      container.Register(
          AllTypes.FromAssemblyContaining&lt;IShouter&gt;()
                  .Where(x =&gt; x.Namespace.StartsWith("WindowsBash"))
                  .WithService.AllInterfaces());
  
      var MyShouter = container.Resolve&lt;IShouter&gt;();
      var result = MyShouter.Display();
  }
  </code></pre>
  
  <p>Right now this always returns "Hello". If I wanted it to return "Bye", what would I need to change without changing the order of the classes?</p>