Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7065755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:59:41+00:00 2026-05-28T04:59:41+00:00

I have a massive amount of repeating code that I wish to replace in

  • 0

I have a massive amount of repeating code that I wish to replace in the legacy code base and found Resharper’s Structural Search and Replace feature to be a good match for the task. However I have problems making it match my patterns.

The pattern I wish to have quick-fixes for is:

public string PropertyName
{
    get { return base.GetSubNode(_parameterNode, "ElementName").InnerText; }
    set { base.GetSubNode(_parameterNode, "ElementName").InnerText = value; }
}

It’s to be replaced with:

public string PropertyName
{
    get { return GetProperty("ElementName"); }
    set { SetProperty("ElementName", value); }
}

I created a pattern:

public string $propName$
{
    get { return base.GetSubNode(_parameterNode, $elementName$).InnerText; }
    set { base.GetSubNode(_parameterNode, $elementName$).InnerText = value; }
}

The pattern matches if i do a search, but does not result in a quick fix being available. If I instead create a separate pattern for the getter and setter I get quick fixes, but the getter pattern matches both the getter and the setter.

The getter pattern:

base.GetSubNode(_parameterNode, $elementName$).InnerText

How can I get quick-fixes for this getter/setter pair?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:59:42+00:00Added an answer on May 28, 2026 at 4:59 am

    The following search/replace pattern works like a charm in ReSharper 6.1:

        <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
        <s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/@KeyIndexDefined">True</s:Boolean>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/Comment/@EntryValue">GetSubNode calls in property accessors</s:String>
        <s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/FormatAfterReplace/@EntryValue">False</s:Boolean>
        <s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/IsReplacePattern/@EntryValue">True</s:Boolean>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/LanguageName/@EntryValue">CSHARP</s:String>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/ReplaceComment/@EntryValue">Replace GetSubNode with GetProperty or SetProperty call</s:String>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/ReplacePattern/@EntryValue">public string $propName$&#xD;
    {&#xD;
        get { return GetProperty($elementName$); }&#xD;
        set { SetProperty($elementName$, value); }&#xD;
    }&#xD;
    </s:String>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/SearchPattern/@EntryValue">public string $propName$&#xD;
    {&#xD;
        get { return base.GetSubNode(_parameterNode, $elementName$).InnerText; }&#xD;
        set { base.GetSubNode(_parameterNode, $elementName$).InnerText = value; }&#xD;
    }&#xD;
    </s:String>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/Severity/@EntryValue">SUGGESTION</s:String>
        <s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/ShortenReferences/@EntryValue">False</s:Boolean>
        <s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/CustomPatternPlaceholder/=elementName/@KeyIndexDefined">True</s:Boolean>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/CustomPatternPlaceholder/=elementName/Properties/=Maximal/@EntryIndexedValue">-1</s:String>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/CustomPatternPlaceholder/=elementName/Properties/=Minimal/@EntryIndexedValue">-1</s:String>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/CustomPatternPlaceholder/=elementName/Type/@EntryValue">ArgumentPlaceholder</s:String>
        <s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/CustomPatternPlaceholder/=propName/@KeyIndexDefined">True</s:Boolean>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/CustomPatternPlaceholder/=propName/Properties/=CaseSensitive/@EntryIndexedValue">True</s:String>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/CustomPatternPlaceholder/=propName/Properties/=ExactType/@EntryIndexedValue">False</s:String>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/CustomPatternPlaceholder/=propName/Properties/=RegEx/@EntryIndexedValue"></s:String>
        <s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B4B745BE8847784E9BF34E217AEB9C3B/CustomPatternPlaceholder/=propName/Type/@EntryValue">IdentifierPlaceholder</s:String></wpf:ResourceDictionary>
    

    Save it to a .dotsettings file, and import to your ReSharper installation via ReSharper > Manage Options > [layer name] > Import/Export Settings > Import from file

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a massive amount of input data (that's why I use Hadoop) and
I have a massive amount of data that needs to be read from mysql,
I am importing massive amounts of data from Excel that have various table layouts.
I thought the Linux kernel would have a massive amount of SLOC but it
There are cases when you have many UI updates due a massive amount of
I have a large amount of data that I am pulling from an xml
I have an app that needs to update a large amount of data over
I have a massive XML file. However, I'm only interested in a single small
Background I have a massive db for a SharePoint site collection. It is 130GB
Background Info: File Replication is Lame Currently, we have a massive, high-traffic ASP.NET web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.