title: Resharper Custom Patterns: Ignore property attributes
body: <p>I am writing some Resarper Custom Patterns to warn us about some code constructs that need attention. One of these is replacing OnpropertyChanged("String") with a lambda variant OnPropertyChanged(() => propertyname)</p>
  
  <p>The search Pattern I defined is:</p>
  
  <pre><code> public $type$ $property$
   {
              get { return $backingfield$; }
              set
              {
                  if($backingfield$  != value) {
                      $backingfield$ = value;
                      OnPropertyChanged($String$);
                  }
             }
   }
  </code></pre>
  
  <p>This pattern is being replaced with:</p>
  
  <pre><code>public $type$ $property$
  {
          get { return $backingfield$; }
          set
          {
              if($backingfield$  != value) {
                  $backingfield$ = value;
                  OnPropertyChanged(() =&gt; $property$);
              }
          }
  }
  </code></pre>
  
  <p><strong>Problem:</strong>
  When applying this, Resharper throws away the attributes defined on the property.
  This snippet:</p>
  
  <pre><code>[MyAttribute]
  public int Test
  {
              get { return _Test; }
              set
              {
                  if (_Test != value)
                  {
                      _Test = value;
                      OnPropertyChanged("Test");
                  }
              }
  }
  </code></pre>
  
  <p>gets replaced with</p>
  
  <pre><code>public int Test
  {
              get { return _Test; }
              set
              {
                  if (_Test != value)
                  {
                      _Test = value;
                      OnPropertyChanged(() =&gt; Test);
                  }
              }
  }
  </code></pre>
  
  <p>How can I preserve the attributes??</p>
  
  <p><strong>UPDATE</strong>:
  Adding a type placeholder derived from System.Attribute to both search and replace pattern fixes it partially.</p>
  
  <pre><code>[$Attributes$]
  ...
  </code></pre>
  
  <p><strong>Remaining problem</strong> is that the Attribute placeholder only matches one attribute, it fails on multiple attributes.</p>