title: Avoiding Magic strings Reflection vs Constant
body: <h2>What would be a better approach to avoid the magic, based on the following 2 examples?</h2>
  
  <p><br/>
  <strong>Known relationship</strong><br/>
  <em>we know the Class which is meant</em></p>
  
  <pre><code>    public string Notes
      {
          get { return notes; }
          set { SetPropertyValue("Notes", ref notes, value); }
      }
  </code></pre>
  
  <p><strong>Unknow relationship</strong><Br/></p>
  
  <p><em>we do not know the class (because multiple classes could have a property with this name) or even if the property exist here</em></p>
  
  <pre><code>public void SomeStuffeChanged()
  {
      PropertyEditor propertyEditor = ((DetailView)View).FindItem("Anniversary") as PropertyEditor;
      // do some stuff
  }
  </code></pre>
  
  <p><br/></p>
  
  <p>I could create a define class/es which will contain all properties as const so i would avoid redundance of my properties, but it's also work to maintain this define.</p>
  
  <p><br/></p>
  
  <p>When i would go for reflection i would do just <code>MemberName.GetMemberName&lt;Contact&gt;( x=&gt; x.Anniversary)</code> and any changed would be automatically applied, but when i have the second case where i just assume there could be this property. I can't use the show reflection because even if the code is still valid the propertyname could have changed in a other class. Also reflection add's some overhead.</p>
  
  <hr>
  
  <h2>Update</h2>
  
  <p>The Question is strongly related with DevExpress because they use "MagicStrings" all over the place and you can't change the baseclass</p>