I write tons of immutable types following this pattern:
class A 
{
  private readonly SomeType b;
  public A(SomeType b)
  {
    this.b = b;
  }
  public SomeType B
  {
    get {return b; }
  }
}
Is it possible to replicate this pattern using auto-properties? The closes I could get to is:
class A 
{
  public A(SomeType b)
  {
    B = b;
  }
  public SomeType B
  {
    get; private set;
  }
}
But it is not really satisfactory, as it doesn't guarantee that the reference to B is not going to change (we lost the readonly effectively). Is it possible to do better than that?
 
    