title: Should I throw an exception or return false?
body: <p>I'm developing a simple service locator in C# using TDD.</p>
  
  <p>At the moment, I've created a <code>TryAddService</code> method that looks like this:</p>
  
  <pre><code>    public bool TryAddService(Type type, object service)
      {
          if (service == null)
          {
              return false;
          }
  
          if (this.services.ContainsKey(type))
          {
              return false;
          }
  
          if (!type.IsAssignableFrom(service.GetType()))
          {
              return false;
          }
  
          this.services.Add(type, service);
  
          return true;
      }
  </code></pre>
  
  <p>My question is, should I be returning false in all these cases? Or should I throw an exception?</p>
  
  <p>My customers in this scenario would be other developers.</p>