title: Only allow setting a property from a specific class / instance
body: <p>imagine I have two classes A and B where B has the properties BProperty1 and BProperty2.</p>
  
  <ul>
  <li>The property BProperty1 shall only be settable by class A (no matter which instance) </li>
  <li>The property BProperty2 shall only be settable by a concrete instance of class A (the reference to this instance could e.g. be stored on BProperty1). </li>
  </ul>
  
  <p>Is it possible to realize something like that, is there maybe a pattern for it? Please note that A and B are independent, none of them derives from the other one! I'm using C# and WPF. Thanks for any hint!</p>
  
  <p><strong>EDIT</strong>
  An example:</p>
  
  <p>Imagine a class Car and a class CarDoor. Whenever a CarDoor is added to a Car, the CarDoors property AssociatedCar is set to the Car it's assigned to, because this reference is needed later. But how to make sure the AssociatedCar property is not set by the user, but by the Car class when AddCarDoor(door) is called?</p>
  
  <pre><code>class Car
  {
      private List&lt;CarDoor&gt; _carDoors = new List&lt;CarDoor&gt;();
  
      public Car()
      {
  
      }
  
      public void AddCarDoor(CarDoor door)
      {
          // Add the door to the car
          _carDoors.Add(door);
  
          // Save a reference to the car assigned to the door
          door.AssociatedCar = this;
      }
  }
  
  
  class CarDoor
  {
      public Car AssociatedCar;
  
      public CarDoor()
      {
  
      }
  }
  </code></pre>