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 7839961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:36:48+00:00 2026-06-02T15:36:48+00:00

Assuming I have some object like, with LOTS of properties: public class SomeObject {

  • 0

Assuming I have some object like, with LOTS of properties:

public class SomeObject
{
  public SomeOtherObject1 Property1 { get; set; }
  public SomeOtherObject2 Property2 { get; set; }
  public SomeOtherObject3 Property3 { get; set; }
  public SomeOtherObject4 Property4 { get; set; }
  public SomeOtherObject5 Property5 { get; set; }
  public SomeOtherObject6 Property6 { get; set; }
}

It would be really cool if I could create a constructor and copy the properties into the constructor…

public class SomeObject
{
  public SomeObject
  {
    public SomeOtherObject1 Property1 { get; set; }
    public SomeOtherObject2 Property2 { get; set; }
    public SomeOtherObject3 Property3 { get; set; }
    public SomeOtherObject4 Property4 { get; set; }
    public SomeOtherObject5 Property5 { get; set; }
    public SomeOtherObject6 Property6 { get; set; }
  }

  public SomeOtherObject1 Property1 { get; set; }
  public SomeOtherObject2 Property2 { get; set; }
  public SomeOtherObject3 Property3 { get; set; }
  public SomeOtherObject4 Property4 { get; set; }
  public SomeOtherObject5 Property5 { get; set; }
  public SomeOtherObject6 Property6 { get; set; }
}

And use Visual Studio’s Find And Replace with Regex to change the highlighted lines in the constructor from:

    public SomeOtherObject1 Property1 { get; set; }
    public SomeOtherObject2 Property2 { get; set; }
    public SomeOtherObject3 Property3 { get; set; }
    public SomeOtherObject4 Property4 { get; set; }
    public SomeOtherObject5 Property5 { get; set; }
    public SomeOtherObject6 Property6 { get; set; }

to:

    this.Property1 = new SomeOtherObject1();
    this.Property2 = new SomeOtherObject2();
    this.Property3 = new SomeOtherObject3();
    this.Property4 = new SomeOtherObject4();
    this.Property5 = new SomeOtherObject5();
    this.Property6 = new SomeOtherObject6();

First I tried:

public\s{:i}\s{:i}\s{\sget;\sset;\s}

this.\2 = new \1();

Then I thought maybe it was a line issue, so I tried:

^\s*public\s{:i}\s{:i}\s{\sget;\sset;\s}.$

this.\2 = new \1();

Anyone else have any thought on how to get this to work?

  • 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-06-02T15:36:53+00:00Added an answer on June 2, 2026 at 3:36 pm

    You need to escape the {} around get; set;. Also, I’ve used :b instead of \s and allowed for more than one. Here:

    public:b+{:i}:b+{:i}:b*\{:b*get;:b*set;:b*\}
    

    And as you wrote:

    this.\2 = new \1();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming I have a class like public class FooImpl { public void bar(){}; }
I have created an array object with some dummy properties, I have have also
I have come across some strange behaviour, and I'm assuming a bug in Firefox,
Assuming I have to use C (no C++ or object oriented compilers) and I
I have my own db class which has some purpose built functions that I
Assuming you have a DOM tree with nested tags, I would like to clean
I'd like to know how multiprocessing is done right. Assuming I have a list
I have seen examples containing things like this: mountSharedResource(/images/logo.gif, new ResourceReference(ImageScope.class, logo.gif).getSharedResourceKey()); mountSharedResource(/resource, Application.class.getName()
Assuming I have an object Person with long id String firstName String lastName String
Assuming you have a string containing the name of a method, an object that

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.