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

  • Home
  • SEARCH
  • 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 122495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:08:15+00:00 2026-05-11T04:08:15+00:00

Ok, so I’m having a hard time coming up with a ‘good’ way to

  • 0

Ok, so I’m having a hard time coming up with a ‘good’ way to do the following:

Group 4 objects so that if I Object A I can easily and without having to go through Objects B & C to find out if Object D relates to Object A. As well as any other combination of referencing.

I am currently using SortedLists to link A to B and B to C and C to D and doing a really sloppy job of cross referencing them. This works, but its really, really ugly. I don’t like ugly code unless there is no other way to do it.

I’m thinking of using a class to store the objects. But what would be the best way to reference them?

Thanks in advance


More info:

The objects are controls on a form. The 4 different controls are all related to each other in that they correspond to the same setting that they are used to configure. There are multiple settings that get modified on the form, each using 4 controls.

I need a way to easily reference them without having to call Setting4ControlB.Checked or Setting2ControlD.text, thus the linked lists. I’m using generic events for certain controls in order to reuse code, they all do the same thing, except they reference different objects.

The ugly portion is first, setting up the links, and second, doing the referencing from A to D or C to A, etc. I wanted to be able to do something like this:

GetSettingControls(ReferencingControl).ControlA.Checked

ReferencingControl would be the sender in the event, ControlA is a control that is related to ReferencingControl.

  • 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. 2026-05-11T04:08:16+00:00Added an answer on May 11, 2026 at 4:08 am

    First of all, if you have a relationship like A->B->C->D the only way to see if A relates to D is to go all the way from A to D. You can nontheless apply a few tricks

    This will involve manually keeping track of each indirect reference present in the program, that is, you’ll be in charge of adding the A->D reference dinamically, that may be useful with certain logics like for example being able to ‘carry’ objects in a game.

    You need to use a Dictionary of WeakReferences, so that you don’t keep objects alive through references…

    public class MyObject {   public List<WeakReference> References = new List<WeakReference>();    // My Class Properties and Methods }  MyObject obj = new MyObject(); obj.refence.Add(new WeakReference(gun)); 

    that way if the gun is cleared from the object pool (for example the userObjects collection from your Level.Objects collection) the weakreference will become invalid.

    You can check for the object by doing

    foreach ref in obj.references   if (ref.IsAlive)     object tool = ref.Target; 

    This is just an example, you know, implement good accessors, properties and so on…

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build

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.