title: Is it possible to call a property setter with a different type as the property's type itself?
body: <p>I have a Layer class with a unique Name property serving as identifier:</p>
  
  <pre><code>public class Layer {
      public string Name { get; set; }
      ...
      // Various other properties
      ...
  }
  </code></pre>
  
  <p>Furthermore I have a DiagramHandler which handles (among other things) the layer management</p>
  
  <pre><code>public class DiagramHandler {
      private Layer _activeLayer;
      public Layer ActiveLayer {
          get { return _activeLayer; }
          set {
              Layer layer = DiagramLayers.FirstOrDefault(l =&gt; l.Name.Equals(value.Name);
              if (layer != null) {
                  _activeLayer = layer;
              } else {
                  // Error handling
              }
          }
      }
  
      public ICollection&lt;Layer&gt; DiagramLayers { get; set; }
  }
  </code></pre>
  
  <p>As you can see, I have stored all possible layers in a collection within the handler and a single currently active one in its own property. If the latter one gets set, one of the Layers in the collection is identified and set as the active layer. Now, as I actually only need the layer name to properly identify the layer I wonder whether I could pass over just a string to the ActiveLayer's setter instead of a whole layer. So I could do this:</p>
  
  <pre><code>// Yes, the DiagramHandler is a singleton
  DiagramHandler.Instance.ActiveLayer = "Background";
  </code></pre>
  
  <p>instead of having to do this:</p>
  
  <pre><code>DiagramHandler.Instance.ActiveLayer = new Layer() { Name = "Background" };
  </code></pre>
  
  <p>I'm aware I could use a setter function (which I actually do right now) but I'd prefer the use of a plain property setter and was curious if there's a language feature I just don't know or if there's a more elegant and nice solution.</p>