title: How can I make a Property Read-only Declared in Interface in C#
body: <p>I'm using Interfaces for Dependency Injection.</p>
  
  <p>Here is my Interface</p>
  
  <pre><code>public interface IRepository 
  {
      bool IsTxOpened { get; set; }
      //.....
  }
  </code></pre>
  
  <p>And Implementation Class </p>
  
  <pre><code>public class RepositoryImpl : IRepository, IDisposable
  {
      //.........
      public bool IsTxOpened { get { return _txIsOpened; } private set { _txIsOpened = value; }}
      //................
  }
  </code></pre>
  
  <p>And Here is my Controller Class</p>
  
  <pre><code>public class EmployeeController : Controller
  {
      //.........
      private IRepository _repository;
  
      public EmployeeController(IRepository repository)
      {           
          _repository = repository;
      }
      //...........
  }
  </code></pre>
  
  <p>I can not mark <strong>set</strong> as private in Interface. I need <strong>Set</strong> and <strong>Get</strong> both and I do not want to expose <strong>Set</strong> to (I do not want to make it public) other classes. Is there any way to do that.</p>