title: Explicit Interface Implementation and Multiple Interfaces
body: <p>In some locations of my program I need access to the concrete implementation of an object (Test) and in other locations I only need a read-only interface (ITest).  This is to prevent an user from assuming that all properties are set and modifiable  </p>
  
  <p>For example if the user calls TestFactory.Search the returned collection will prevent them from modifying the property A and using CollectionB (it is not set inside the function).  I would like to be able to use object initializers and keep the properties names the same.  I have the following solution:   </p>
  
  <pre><code>public interface IReadOnly
  {
      int Id{ get; }
      string Name{ get; }
  }
  
  public class ClassA : IReadOnly
  {
      int Id{ get; internal set; }
      string Name{ get; set; }
  }
  
  public interface ITest
  {
      int Id{ get; }
      IReadOnly A { get; }
  }
  
  public class Test : ITest
  {
      private ClassA classA = new ClassA();
  
      int Id{ get; internal set; }
      IReadOnly ITest.A{ get{ return classA; } }
      public ClassA A
      { 
          get
          { 
              return classA;
          }  
          set
          {
               classA = value;
          }
      }
  
      public IEnumerable&lt;string&gt; CollectionB {get;set;}
  }
  
  public static class TestFactory
  {
      IEnumerable&lt;ITest&gt; Search(){ /**/ }
      Test Read(){ /**/ };
  }
  </code></pre>
  
  <p>Is there a better way to solve this problem and is the abusing the concept of explicit interface implementation?</p>