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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:41:38+00:00 2026-05-31T10:41:38+00:00

Try not to get too hung up on what I’m doing here, this is

  • 0

Try not to get too hung up on what I’m doing here, this is just an example:

var @string = new RegexTerm("...");
var literal = new RegexTerm("...");
var key = @string | literal;
var dict = new Term();
var value = key | dict;
var kvp = key | value;
var item = key | kvp;
var set = item + !("," + item);
dict = "{" + set + "}";

I have a circular relationship. value needs dict to be defined, and dict needs value to be defined.

So what I’ve done is initialized dict to some placeholder Term so that I can use it in the following assignment, and then I give it it’s real value later on.

The problem is that now value no longer refers to the same object as defined on the last line. I essentially want to re-assign dict without creating a new object.

Is there any way to do this without adding a setter? This would require me to create a public parameterless constructor on my AndTerm and then add a Set method, which just isn’t as pretty, and allows you to construct invalid objects.

Or is there some magical way of reassigning dict to point to a new object and update all existing references? Apparently I’m not allowed to overload the = operator.


Came up with one solution. I added an extra Term called a ProxyTerm:

var dict = new ProxyTerm();
var value = key | dict;
...
dict.Term = "{" + set + "}";

This allows me to keep the base Term class as abstract, and then I don’t need to expose any private variables or add any setters.

  • 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-31T10:41:40+00:00Added an answer on May 31, 2026 at 10:41 am

    A solution would be to code against an interface or an abstract base and use a proxy pattern.

    class ProxyTerm : ITerm {
    
         ITerm Reference { get; set; }
    
         ITerm.SomeMethod() {
              Reference.SomeMethod();
         }
    
    }
    

    This way you’ll be able to plug in the real reference afterwards.

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

Sidebar

Related Questions

Whenever i try to run sqlmetal, i get this: 'sqlmetal' is not recognized as
I'm not quite sure why if I try to free the data I get
The official oauth guide makes this recommendation: It is important not to try and
Try to see which cast is faster (not necessary better): new c++ case or
anyone knows why this does not work when I try to include a library
I'm not sure how I should express this, but I'll give it a try.
I've got this medium-sized app that is starting to get too complex. I'm considering
I'm not too new to VB.Net and the syntax, but I'm not an expert.
Hope my question does not pose as too wide. So I try to frame
I'm not too sure if this is the best place to pose this question

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.